先安装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
源码:
#!/bin/env perl
# Created : zhuxu@taobao.com
# Perl Module Need :
# sudo yum install dba-perl-DBI -b test
# sudo yum install dba-DBD-MySQL -b test
# sudo yum install Term-ReadKey -b test
# Version :
# 1.0 Modified @ 2012/11/09
# 1.1 Modified @ 2013/01/02
# add --help ,and hightlight/no case sensitive filter sql
use strict;
use DBI;
use Term::ReadKey;
use Term::ANSIColor;
use POSIX qw(strftime);
use Getopt::Long;
Getopt::Long::Configure qw(no_ignore_case);
# autoflush
$| = 1;
# Get options info
my %opt;
安装依赖的包:
[root@hank-yoon servers]#
否则报错如下:
[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
Usage :
Command line options :
==========================================================================================
[root@hank-yoon servers]# ./orztop
![MySQL监控工具-orztop](https://i-blog.csdnimg.cn/blog_migrate/a4c26d1e5885305701be709a3d33442f.gif)
信息中还包括了数据库的每秒的insert/update/delete/select,逻辑读,命中率,当前活动线程等,可以大致看到数据库的当前压力情况;
当你的实例出现性能瓶颈时,不妨用该工具看看,抓取一下当前正在跑的慢sql
源码:
#!/bin/env perl
# Created
# Perl Module Need :
#
#
#
# Version
#
#
#
use strict;
use DBI;
use Term::ReadKey;
use Term::ANSIColor;
use POSIX qw(strftime);
use Getopt::Long;
Getopt::Long::Configure qw(no_ignore_case);
# autoflush
$| = 1;
# Get options info
my %opt;