推荐使用mtop
mtop是一个类似于unix系统下top命令的小工具,针对mysql的运行情况进行动态显示。
1.可去官站下载
2.安装可参考其安装包中的README文件
安装此工具之前,有些软件环境需要布置:
mtop requires the following perl modules:
Module Available At
------------ --------------------------------------------------------
Curses http://www.cpan.org/authors/id/WPS
DBI Distributed as Bundle::DBI: http://www.cpan.org/authors/id/TIMB
DBD::mysql http://www.cpan.org/authors/id/JWIED
Getopt::Long (Distributed with Perl 5)
Net::Domain Part of libnet: http://www.cpan.org/authors/id/GBARR/
Module Available At
------------ --------------------------------------------------------
Curses http://www.cpan.org/authors/id/WPS
DBI Distributed as Bundle::DBI: http://www.cpan.org/authors/id/TIMB
DBD::mysql http://www.cpan.org/authors/id/JWIED
Getopt::Long (Distributed with Perl 5)
Net::Domain Part of libnet: http://www.cpan.org/authors/id/GBARR/
可以先进行安装,如果少什么,它会提示的。我少的是Curses与DBD::mysql。
2.1 安装Curses
说起来这个东东其它是比较难安装的,方法有很多,但是有时候能折腾好长时间。为了节省时间,我一般选择使用CPAN或yum安装。
使用CPAN安装时遇到了一些麻烦,没有make成功。所以直接使用yum(第三方源)
安装导入第三方源:
# wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
# rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
# rpm -k rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
# rpm -ivh rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
# yum install perl-Curses
# rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
# rpm -k rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
# rpm -ivh rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
# yum install perl-Curses
2.2 DBD::mysql 使用CPAN安装:
# perl -MCPAN -e shell
cpan> install DBD::mysql
cpan> install DBD::mysql
2.3 安装mtop
# cd mtop-0.6.6
# perl Makefile.PL
# make && make install
# perl Makefile.PL
# make && make install
参考:
http://fosschef.com/2011/03/making-pseudo-screensaver-under-cli/