Innotop的安装和使用

时间:2024-04-16 12:36:22

功能特点
1.显示当前innodb的全部事务列表;
2.显示当前正运行着的查询;
3.显示当前锁和锁等等的列表;
4.服务器状态和变量的摘要信息 显示了数值的相对变化幅度;
5.有多种模式可用来显示Innodb 内部信息,如缓冲区、死锁、外键错误、I/O情况、行操作、信号量等。
6.复制健康,将主机和从机的状态显示一起;
7.有一个显示任意服务器变量的模式;
8.服务器组可以帮你更方便的组织多台服务器;
9.在命令行脚本下可以使用非交互模式。

下载地址
https://github.com/innotop/innotop

安装

# unzip innotop-master.zip
# cd innotop-master
# perl Makefile.PL
Checking if your kit is complete...
Looks good
Warning: prerequisite Term::ReadKey 2.1 not found.
Writing Makefile for innotop
报以上错误,缺少ReadKey包。 # yum search ReadKey
# yum install perl-TermReadKey -y
# perl Makefile.PL
# make install
cp innotop blib/script/innotop
/usr/bin/perl -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/innotop
Manifying blib/man1/innotop.1
Installing /usr/local/share/man/man1/innotop.1
Installing /usr/local/bin/innotop
Appending installation info to /usr/lib64/perl5/perllocal.pod

  

查看帮助

# innotop --help
Usage: innotop <options> <innodb-status-file> --askpass Prompt for a password when connecting to MySQL
--[no]color -C Use terminal coloring (default)
--config -c Config file to read
--count Number of updates before exiting
--delay -d Delay between updates in seconds
--help Show this help message
--host -h Connect to host
--[no]inc -i Measure incremental differences
--mode -m Operating mode to start in
--nonint -n Non-interactive, output tab-separated fields
--password -p Password to use for connection
--port -P Port number to use for connection
--skipcentral -s Skip reading the central configuration file
--socket -S MySQL socket to use for connection
--spark Length of status sparkline (default 10)
--timestamp -t Print timestamp in -n mode (1: per iter; 2: per line)
--user -u User for login if not current user
--version Output version information and exit
--write -w Write running configuration into home directory if no config files were loaded 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.

  

登录进来后,默认是Dashboard。Innotop支持多种模式,Dashboard只是其中一种模式。通过“?”键我们可以查看所有模式

[RO] Dashboard (? for help)             localhost, 314d, 1.95 QPS, 70/1/4 con/run/cac thds, 5.7.18-log

Switch to a different mode:
A Dashboard I InnoDB I/O Info Q Query List
B InnoDB Buffers K InnoDB Lock Waits R InnoDB Row Ops
C Command Summary L Locks S Variables & Status
D InnoDB Deadlocks M Replication Status T InnoDB Txns
F InnoDB FK Err O Open Tables U User Statistics Actions:
d Change refresh interval q Quit innotop
k Kill a query's connection r Reverse sort order
n Switch to the next connection s Choose sort column
p Pause innotop x Kill a query Other:
TAB Switch to the next server group / Quickly filter what you see
! Show license and warranty = Toggle aggregation
# Select/create server groups @ Select/create server connections
$ Edit configuration settings \ Clear quick-filters
Press any key to continue