下载地址:https://github.com/innotop/innotop
[root@localhost src]# git clone git@github.com:innotop/innotop.git
[root@localhost src]# cd innotop(进入该目录)
[root@localhost innotop]# perl Makefile.PL
[root@localhost innotop]# make
[root@localhost innotop]# make make test
[root@localhost innotop]# make install(到这里已经安装完成了)
安装好了mysql监控神器innotop,正得意,innotoop不可用,其错误提示为localhost PROCESSLIST_NO_IS: install_driver(mysql) failed: Can't load '/usr/lib64/perl5/vendor_perl/auto/DBD/mysql/mysql.so' for module DBD::mysql: libmysqlclient.so.18: cannot open shared object file: No such file or directory at /usr/lib64/perl5/DynaLoader.pm line 190.
at (eval 561) line 3.
Compilation failed in require at (eval 561) line 3.
Perhaps a required shared library or dll isn't installed where expected
at /root/perl5/bin/innotop line 7741.
经查原有又是DBD惹的祸。这个问题已经发生过好几次了。
1、故障现象
[root@localhost ~]# uname -a
Linux localhost.localdomain 3.10.0-957.el7.x86_64 #1 SMP Thu Nov 8 23:39:32 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
[root@dbsrv1 ~]# innotop
localhost PROCESSLIST_NO_IS: install_driver(mysql) failed: Can't load '/usr/lib64/perl5/vendor_perl/auto/DBD/mysql/mysql.so' for module DBD::mysql: libmysqlclient.so.18: cannot open shared object file: No such file or directory at /usr/lib64/perl5/DynaLoader.pm line 190.
at (eval 561) line 3.
Compilation failed in require at (eval 561) line 3.
Perhaps a required shared library or dll isn't installed where expected
at /root/perl5/bin/innotop line 7741.
2、安装perl-DBD-MySQL
[root@localhost src]# yum install perl-DBD-MySQL
Loaded plugins: fastestmirror, protectbase
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
(1/3): docker-ce-stable/7/x86_64/primary_db | 70 kB 00:00:00
(2/3): epel/x86_64/primary_db | 7.0 MB 00:00:03
(3/3): updates/7/x86_64/primary_db | 13 MB 00:00:04
0 packages excluded due to repository protections
Package perl-DBD-MySQL-4.023-6.el7.x86_64 already installed and latest version
Nothing to do
###上面描写叙述已经perl-DBD-MySQL已经安装。且为最新的版本号
[root@dbsrv1 yum.repos.d]# rpm -qa |grep -i dbd
perl-DBD-MySQL-4.023-6.el7.x86_64
###首先先卸载perl-DBD-MySQL。然后再次使用yum安装
[root@dbsrv1 yum.repos.d]# rpm -e --nodeps perl-DBD-MySQL-4.023-6.el7.x86_64
[root@dbsrv1 yum.repos.d]# rpm -qa |grep -i dbd(再次查询寻有无该包)
[root@localhost src]# yum install perl-DBD-MySQL
Loaded plugins: fastestmirror, protectbase
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
0 packages excluded due to repository protections
Resolving Dependencies
--> Running transaction check
---> Package perl-DBD-MySQL.x86_64 0:4.023-6.el7 will be installed
--> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: perl-DBD-MySQL-4.023-6.el7.x86_64
--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: perl-DBD-MySQL-4.023-6.el7.x86_64
--> Running transaction check
---> Package mysql-community-libs-compat.x86_64 0:5.7.36-1.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=================================================================================================================================================================================================================================================
Package Arch Version Repository Size
=================================================================================================================================================================================================================================================
Installing:
perl-DBD-MySQL x86_64 4.023-6.el7 base 140 k
Installing for dependencies:
mysql-community-libs-compat x86_64 5.7.36-1.el7 mysql57-community 1.2 M
Transaction Summary
=================================================================================================================================================================================================================================================
Install 1 Package (+1 Dependent package)
Total download size: 1.3 M
Installed size: 6.3 M
Is this ok [y/d/N]: y
Downloading packages:
(1/2): perl-DBD-MySQL-4.023-6.el7.x86_64.rpm | 140 kB 00:00:00
(2/2): mysql-community-libs-compat-5.7.36-1.el7.x86_64.rpm | 1.2 MB 00:00:01
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 827 kB/s | 1.3 MB 00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
** Found 4 pre-existing rpmdb problem(s), 'yum check' output follows:
mytop-1.7-10.b737f60.el7.noarch has missing requires of perl(DBD::mysql) >= ('0', '1', None)
percona-xtrabackup-24-2.4.4-1.el7.x86_64 has missing requires of perl(DBD::mysql)
2:postfix-2.10.1-9.el7.x86_64 has missing requires of libmysqlclient.so.18()(64bit)
2:postfix-2.10.1-9.el7.x86_64 has missing requires of libmysqlclient.so.18(libmysqlclient_18)(64bit)
Installing : mysql-community-libs-compat-5.7.36-1.el7.x86_64 1/2
Installing : perl-DBD-MySQL-4.023-6.el7.x86_64 2/2
Verifying : mysql-community-libs-compat-5.7.36-1.el7.x86_64 1/2
Verifying : perl-DBD-MySQL-4.023-6.el7.x86_64 2/2
Installed:
perl-DBD-MySQL.x86_64 0:4.023-6.el7
Dependency Installed:
mysql-community-libs-compat.x86_64 0:5.7.36-1.el7
Complete!
###再次启用innotop正常
[root@dbsrv1 yum.repos.d]# innotop -uroot -pxxxxxx
Uptime MaxSQL ReplLag QPS Cxns Run Miss Lock Tbls Repl SQL
2d13h 0.01 1 0.00 0 119
输入?,则进入帮助页面
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 StatisticsActions:
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 queryOther:
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
第一部分为可切换的模式-输入相应的大写字母
第二部分可进行的操作-输入相应的小写字母
第三部分 其他-配置类操作
Q Query List
innodb中最常用的模式,输入大写Q,进入该模式的视图页面。
[RO] Query List (? for help) localhost, 2d13h, 3.07 QPS, 1/1/1 con/run/cac thds, 5.7.36
When Load Cxns QPS Slow Se/In/Up/De% QCacheHit KCacheHit BpsIn BpsOut
Now 0.05 1 3.07 0 0/ 0/ 0/ 0 0.00% 100.00% 79.91 4.38k
Total 0.00 151 0.02 0 0/ 0/ 0/ 0 0.00% 50.00% 0.29 74.44Cmd ID State User Host DB Time Query
参数详解
Load 是负载
QPS (Query Per Second) 表示每秒的查询率
Slow 代表慢查询的个数
Se/In/Up/De%: 查询/插入/更新/删除的比例
QCacheHit:查询缓冲的命中率
KCacheHit:索引的命中率
BpsIn (bytes Per Second in) 每秒输入的字节数
BpsOut(bytes Per Second Out)每秒输出的字节数
待完善..........................