mytop 是一個用 perl 寫的 console-based 的mysql效能監控工具
要使用它必須先安裝一些 perl 的 module
DBI
Term::ReadKey
Term::ANSIColor
Time::HiRes
用 CPAN 安裝這些 module
首先要切換為 root 權限
[root@localhost]# perl -MCPAN -e shell
/usr/lib/perl5/5.8.5/CPAN/Config.pm initialized.
...略...
Are you ready for manual configuration? [yes] no (直接採用預設值自動設定即可, 輸入 no)
...略...
cpan shell -- CPAN exploration and modules installation (v1.7601)
ReadLine support available (try 'install Bundle::CPAN')
cpan> install Term::ReadKey
CPAN: Storable loaded ok
CPAN: LWP::UserAgent loaded ok
Fetching with LWP:
...略...
/usr/bin/make install -- OK
cpan> install Term::ANSIColor
Running install for module Term::ANSIColor
Running make for R/RR/RRA/ANSIColor-2.02.tar.gz
...略...
/usr/bin/make install -- OK
cpan> install Time::HiRes
Running install for module Time::HiRes
Running make for J/JH/JHI/Time-HiRes-1.9719.tar.gz
Fetching with LWP:
...略...
/usr/bin/make install -- OK
cpan> quit
Terminal does not support GetHistory.
Lockfile removed.
wget http://jeremy.zawodny.com/mysql/mytop/mytop-1.6.tar.gz
tar -zxvf mytop-1.6.tar.gz
cd mytop-1.6
perl Makefile.PL
make
make test
make install
設定預設設定檔:
cd ~
vi .mytop
填入相關帳號資料格式如下
user=mytop
pass=
host=127.0.0.1
db=test
delay=1
port=3306
batchmode=0
header=1
color=1
idle=1
其他詳細說明可用此指令觀看:
perldoc mytop
其他參考資料:
如出現
Use of uninitialized value in substitution (s///) at /usr/bin/mytop line 958.
依下網址內 fix diff patch
http://groups.google.com/group/linux.debian.bugs.dist/browse_thread/thread/7ac750bd208e819a
Ubuntu Linux 9.10 的 MyTop QPS 修正
http://plog.longwin.com.tw/my_note-unix/2009/12/24/ubuntu-910-mytop-qps-fix-2009
SSD mysql 效能測試
http://jnlin.org/category/network/mysql/