innotop是一个不错的MySQL性能分析工具,使用Perl编写的,本身很强大,很值得研究,之前作者在2013年就已经不更新,但是最近作者又开始更新了。而且最新的版本是:version 1.11.4。有兴趣的童鞋还是学习下。会很有收获的。
1、下载
# git clone https://github.com/innotop/innotop.git
2、安装
# yum install perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker perl-DBD-MySQL perl-Time-HiRes perl-TermReadKey
# tar zxvf innotop-<version>.tar.gz
# cd innotop-<version>
# [root@testdb innotop]# ll
-rw-r--r-- 1 root root 19443 Aug 30 09:06 Changelog # 版本升级记录
-rw-r--r-- 1 root root 18092 Aug 30 09:06 COPYING # 版权
-rwxr-xr-x 1 root root 456534 Aug 30 09:06 innotop
-rw-r--r-- 1 root root 4603 Aug 30 09:06 innotop.spec
-rw-r--r-- 1 root root 2379 Aug 30 09:06 INSTALL # 安装手册
-rw-r--r-- 1 root root 23541 Aug 30 09:41 Makefile
-rw-r--r-- 1 root root 584 Aug 30 09:06 Makefile.PL
-rw-r--r-- 1 root root 89 Aug 30 09:06 MANIFEST
-rw-r--r-- 1 root root 743 Aug 30 09:06 README.md
-rw-r--r-- 1 root root 39804 Aug 30 09:06 snapshot_queries.png
drwxr-xr-x 2 root root 4096 Aug 30 09:06 t
[root@testdb innotop]#
# perl Makefile.PL
# make install
# make uninstall # 卸载
3、查看帮助
[root@testdb innotop]# ./innotop --help
Usage: innotop <options> <innodb-status-file>
--askpass 连接MySQL时提示输入密码
--[no]color -C 使用终端颜色(默认)
--config -c 读取配置文件
--count 退出前更新的数目
--delay -d 多久更新一次(单位:秒)
--help 显示帮助
--host -h 需要连接的主机
--[no]inc -i 衡量增量差异
--mode -m 操作模式
--nonint -n 非交互模式, 输出以 tab 操作符分割列
--password -p 连接密码
--port -P 连接端口
--skipcentral -s 不读取中心配置文件
--socket -S 连接socket文件
--spark 星波图显示长度 (默认:10)
--timestamp -t 在 -n 模式打印时间戳 (1: per iter; 2: per line)
--user -u 如果非当前用户,登陆用户。
--version 版本
--write -w 如果没有配置文件加载,把正在运行的配置文件写入家目录
innotop is a MySQL and InnoDB transaction/status monitor, like 'top' for
MySQL. It displays queries, InnoDB transactions, lock waits, deadlocks,
foreign key errors, open tables, replication status, buffer information,
row operations, logs, I/O operations, load graph, and more. You can
monitor many servers at once with innotop.
**显示具体用法:**
# man innotop
# perldoc innotop
4、基本界面
# ./innotop -uroot -p123456 -P3306 -S /tmp/mysql.sock
图片显示了innotop的所有功能。 Innotop功能还是及其强大的,值得大家细细琢磨。