>> Edit article
이름
제목
패스워드
: 안녕하세요? : : 며칠전 PHPSCHOOL.COM에 같은 내용으로 올렸는데 상당히 : 반응이 좋더군요. : 이곳 LSN 만 찾는 분들을 위해서 그대로 포스팅합니다. : : (지금은 mysqld multi 문서 작성중....) : : --------------------------------------------- : : [PHP] class of mysql status : : 현재 자신이 사용하는 데이터베이스 (또는 다른 DB) status와 : MySQL 서버의 status, variables 를 웹에서 모니터링(?)할 수 있도록 : 일부 주요 항목만을 PHP를 이용하여 class로 작성하였습니다. : 또한 : 약간의 코멘트도 추가했으므로 초보자라도 기본적인 MySQL 튜닝 자료로 : 활용할 수 있습니다. : : changes : : - 2003.01.26 : bug fixed, and upgraded comments, support MySQL 4.0.x : - 2003.01.24 : add status of [Threads_cached] : - 2003.01.23 : fixed errata : - 2003.01.20 : add parsing to HTML : - 2003.01.19 : add comments : - 2003.01.10 : get mydb, status, vars : : : 1. 실제 적용예 : : http://linuxchannel.net/?vhost=mysql : : 2. 소스 다운로드 및 online view : : http://ftp.linuxchannel.net/devel/php_mysql_status/ : : class.mysql.status.php.txt 파일을 다운로드하여 class.mysql.status.php : 으로 이름을 rename 하세요 : : /** : * 혹시 마우스로 드래그하여 복사하시는 분은 : * `expand --tabs=8 file.name.php | unexpand -a --tabs=8 > file.name.php' : * 이렇게 공백을 TAB=8으로 수정하세요. : */ : : : 3. 사용법 : : 3.1 object 생성하기 : : $object = new mysql_status($what,$db); : : 새로운 $object를 생성할때 arguments를 2개 전달할 수 있습니다. : 기본값은 $what = 7, $db 는 ''(empty) 입니다. : : ## arguments : : ## $what integer(0 <= $what <= 7), bits of get mode : ## - default : $what 7 : ## - $what 0 : all, same as $what 7 : ## - $what 1 : only my database infomation : ## - $what 2 : only server status : ## - $what 3 : $what 1 + $what 2 : ## - $what 4 : only server variables : ## - $what 5 : $what 1 + $what 4 : ## - $what 6 : $what 2 + $what 4 : ## - $what 7 : $what 1 + $waht 2 + $what 4 : ## $db string, table status of $db, default(current connected database) : : : 3.2 화면에 출력하기 : : $object->tohtml(); // 기본값 : : 또는 : $colors = array(line=>'#404387',th=>'#8899CC',td=>'#DCEDFE'); : $object->tohtml($colors); : : 기본 $colors 값은 : array ( : line=>'#000000', // HTML 테이블 기본 라인색깔(검정) : th =>'#CCCCCC', // HTML 테이블 헤더 색깔(회색) : td =>'#FFFFFF' // HTML 테이블 본문(TD) 색깔(흰색) : ) : 입니다. : : : 4. 사용예 : : http://linuxchannel.net/?vhost=phps&php[src]=%2Fmysql.php : : 또는 : : <?php : require 'class.mysql.status.php'; : : mysql_connect('mysql.server','mysql_user','xxxx'); : mysql_select_db('my_db'); : : $status = new mysql_status; : $status->tohtml(); : : mysql_close(); : ?> : : : 5. 후기 : : 처음 코딩한 목적은 제가 사용하는 DB 용량을 알아보기 위해서 : 간단하게 작성했는데 갑자기(?) 서버 튜팅을 쉽게 (?)하고 싶더군요. : 결국 엄청난 스트레스(단순노동)를 감수하면서 겨우 끝냈습니다. : : 혹시 이와 비슷한 다른 툴이 있는지 모르겠군요.. : (있을것 같은데 귀찮아서 찾아보질 않았습니다.) : : : EOF
Copyleft
1999-2026 by
JSBoard Open Project
Theme Designed by
IDOO
All right reserved