先安装orzdba,链接:http://blog.itpub.net/28939273/viewspace-1875895/安装依赖的包:
[root@hank-yoon servers]# yum install perl-TermReadKey.x86_64
否则报错如下:
[root@hank-yoon servers]# ./orztop -u=root -p=‘yoon‘ -S=/export/data/mysql/tmp/mysql.sock
Can‘t locate Term/ReadKey.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at ./orztop line 14.
BEGIN failed--compilation aborted at ./orztop line 14.
[root@hank-yoon servers]# yum search ReadKey
yum install perl-TermReadKey.x86_64
[root@hank-yoon servers]# ./orztop -help
==========================================================================================
Info :
Created By zhuxu@taobao.com
Usage :
Command line options :
-help Print Help Info.
-h,--host Hostname/Ip to use for mysql connection.
-u,--user User to use for mysql connection.
-p,--pwd Password to use for mysql connection.
-P,--port Port to use for mysql connection(default 3306).
-S,--socket Socket to use for mysql connection.
-t Time(second) Interval.
==========================================================================================
[root@hank-yoon servers]# ./orztop -u=root -p=‘yoon‘ -S=/export/data/mysql/tmp/mysql.sock
信息中还包括了数据库的每秒的insert/update/delete/select,逻辑读,命中率,当前活动线程等,可以大致看到数据库的当前压力情况;
当你的实例出现性能瓶颈时,不妨用该工具看看,抓取一下当前正在跑的慢sql