Mysql运维软件percona-toolkit 安装与故障排除

percona-toolkit工具包同percona-xtrabackup一样都是用Perl写的工具包,percona-toolkit工具包是一组高级的管理mysql的工具包集,可以用来执行各种通过手工执行非常复杂和麻烦的mysql和系统任务,在生产环境中能极大的提高效率,安装也很简单,可以在percona的官网上下载编译包或者是rpm包,下面就是安装过程和使用过程遇到的问题排除:

一、安装:

[root@mydb01 ~]# wget https://www.percona.com/downloads/percona-toolkit/2.2.7/RPM/percona-toolkit-2.2.7-1.noarch.rpm
–2018-12-25 23:25:40– https://www.percona.com/downloads/percona-toolkit/2.2.7/RPM/percona-toolkit-2.2.7-1.noarch.rpm
Resolving www.percona.com… 74.121.199.234
Connecting to www.percona.com|74.121.199.234|:443… connected.
HTTP request sent, awaiting response… 200 OK
Length: 1760229 (1.7M) [application/x-redhat-package-manager]
Saving to: “percona-toolkit-2.2.7-1.noarch.rpm”

100%[==========================================================>] 1,760,229 594K/s in 2.9s

2018-12-25 23:25:45 (594 KB/s) – “percona-toolkit-2.2.7-1.noarch.rpm” saved [1760229/1760229]

[root@mydb01 ~]# rpm -ivh percona-toolkit-2.2.7-1.noarch.rpm
error: Failed dependencies:
perl(DBD::mysql) >= 1.0 is needed by percona-toolkit-2.2.7-1.noarch
perl(IO::Socket::SSL) is needed by percona-toolkit-2.2.7-1.noarch
[root@mydb01 ~]# yum install perl-IO-Socket-SSL perl-DBD-MySQL perl-Time-HiRes perl perl-DBI -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
base | 3.7 kB 00:00
extras | 3.4 kB 00:00
mysql-connectors-community | 2.5 kB 00:00
mysql-tools-community | 2.5 kB 00:00
mysql56-community | 2.5 kB 00:00
updates | 3.4 kB 00:00
Setting up Install Process
Package perl-DBI-1.609-4.el6.x86_64 already installed and latest version
Resolving Dependencies

…………………………………………………….

Complete!
[root@mydb01 ~]# rpm -ivh percona-toolkit-2.2.7-1.noarch.rpm
Preparing… ########################################### [100%]
1:percona-toolkit ########################################### [100%]
[root@mydb01 ~]# which pt-table-checksum
/usr/bin/pt-table-checksum

二、使用时故障排除:

[root@mydb01 ~]# pt-heartbeat –user=root –ask-pass –host=192.168.179.51 –create-table -D hahaer –interval=1 –update –replace –daemonize
Enter password: Cannot read response; is Term::ReadKey installed? 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 /usr/bin/pt-heartbeat line 1682.
[root@mydb01 ~]# pt-heartbeat –user=root –ask-pass –host=192.168.179.51 –create-table -D huanqiu –interval=1 –update –replace –daemonize
Enter password: Cannot read response; is Term::ReadKey installed? 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 /usr/bin/pt-heartbeat line 1682.
[root@mydb01 ~]# which pt-heartbeat
/usr/bin/pt-heartbeat

解决方法:

root@mydb01 ~]# rpm -qa perl-DBI perl-DBD-MySQL perl-Time-HiRes perl-IO-Socket-SSL
perl-DBI-1.609-4.el6.x86_64
perl-Time-HiRes-1.9721-144.el6.x86_64
perl-DBD-MySQL-4.013-3.el6.x86_64
perl-IO-Socket-SSL-1.31-3.el6_8.2.noarch
[root@mydb01 ~]# wget http://pkgs.repoforge.org/perl-TermReadKey/perl-TermReadKey-2.30-1.el3.rf.x86_64.rpm
–2018-12-26 00:21:50– http://pkgs.repoforge.org/perl-TermReadKey/perl-TermReadKey-2.30-1.el3.rf.x86_64.rpm
Resolving pkgs.repoforge.org… 78.46.17.228
Connecting to pkgs.repoforge.org|78.46.17.228|:80… failed: Connection refused.
[root@mydb01 ~]# wget http://pkgs.repoforge.org/perl-TermReadKey/perl-TermReadKey-2.30-1.el3.rf.x[root@mydb01 ~]#
[root@mydb01 ~]# wget http://www6.atomicorp.com/channels/atomic/centos/6/x86_64/RPMS/perl-TermReadKey-2.30-4.el6.art.x86_64.rpm
–2018-12-26 00:24:25– http://www6.atomicorp.com/channels/atomic/centos/6/x86_64/RPMS/perl-TermReadKey-2.30-4.el6.art.x86_64.rpm
Resolving www6.atomicorp.com… 173.203.184.213
Connecting to www6.atomicorp.com|173.203.184.213|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 29728 (29K) [application/x-rpm]
Saving to: “perl-TermReadKey-2.30-4.el6.art.x86_64.rpm”

100%[=======================================================>] 29,728 121K/s in 0.2s

2018-12-26 00:24:26 (121 KB/s) – “perl-TermReadKey-2.30-4.el6.art.x86_64.rpm” saved [29728/29728]

[root@mydb01 ~]# rpm -ivh perl-TermReadKey-2.30-4.el6.art.x86_64.rpm
warning: perl-TermReadKey-2.30-4.el6.art.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5ebd2744: NOKEY
Preparing… ########################################### [100%]
1:perl-TermReadKey ########################################### [100%]
[root@mydb01 ~]# wget http://www6.atomicorp.com/channels/atomic/centos/6/x86_64/RPMS/perl-TermRea[root@mydb01 ~]# wget http://pkgs.repoforge.org/perl-TermReadKey/perl-TermReadKey-2.30-1.el3.rf.x[root@mydb01 ~]# rpm -qa perl-DBI perl-DBD-MySQL perl-Time-HiRes perl-IO-Socket-SSL [root@mydb01 ~]# pt-heartbeat –user=root –ask-pass –host=192.168.179.51 –create-table -D huanqiu –interval=1 –update –replace –daemonize
Enter password:
[root@mydb01 ~]# pt-heartbeat –user=root –ask-pass –host=192.168.179.51 –create-table -D huanqiu –interval=1 –update –replace –daemonize
Enter password:
[root@mydb01 ~]# ps -ef|grep pt-heartbeat
root 1795 1 0 00:26 ? 00:00:00 perl /usr/bin/pt-heartbeat –user=root –ask-pass –host=192.168.179.51 –create-table -D hahaer –interval=1 –update –replace –daemonize
root 1797 1 0 00:27 ? 00:00:00 perl /usr/bin/pt-heartbeat –user=root –ask-pass –host=192.168.179.51 –create-table -D hahaer –interval=1 –update –replace –daemonize
root 1799 1352 0 00:30 pts/0 00:00:00 grep pt-heartbeat

三、使用时故障

[root@mydb01 ~]# pt-heartbeat -D hahaer –table=heartbeat –monitor –host=192.168.179.52 –user=root –password=131468
DBI connect(‘hahaer;host=192.168.179.52;mysql_read_default_group=client’,’root’,…) failed: Access denied for user ‘root’@’192.168.179.51’ to database ‘hahaer’ at /usr/bin/pt-heartbeat line 21373

解决办法:

msyql>GRANT SELECT, PROCESS, SUPER, REPLICATION SLAVE,CREATE,DELETE,INSERT,UPDATE ON *.* TO ‘root’@’192.168.179.51’ identified by ‘131468’;

四、使用时故障:

[root@mydb01 ~]# pt-heartbeat –user=root –ask-pass –host=192.168.179.51 –create-table -D huanqiu –interval=1 –update –replace –daemonize
Enter password:
DBI connect(‘huanqiu;host=192.168.179.51;mysql_read_default_group=client’,’root’,…) failed: Access denied for user ‘root’@’mydb01′ (using password: YES) at /usr/bin/pt-heartbeat line 2137

root@mydb01 ~]# ps -ef|grep heartbeat
root 1823 1352 0 00:58 pts/0 00:00:00 grep heartbeat

解决办法:

[root@mydb01 ~]# rm /tmp/pt-heartbeat-sentinel
rm: remove regular file `/tmp/pt-heartbeat-sentinel’? y
[root@mydb01 ~]# pt-heartbeat –user=root –ask-pass –host=192.168.179.51 –create-table -D hahaer –interval=1 –update –replace –daemonize
Enter password:
[root@mydb01 ~]# ps -ef|grep heartbeat
root 1826 1 0 00:59 ? 00:00:00 perl /usr/bin/pt-heartbeat –user=root –ask-pass –host=192.168.179.51 –create-table -D hahaer –interval=1 –update –replace –daemonize
root 1828 1352 0 01:00 pts/0 00:00:00 grep heartbeat
[root@mydb01 ~]# pt-heartbeat -D huanqiu –table=heartbeat –monitor –host=192.168.179.52 –user=root –password=131468
0.00s [ 0.00s, 0.00s, 0.00s ]
0.00s [ 0.00s, 0.00s, 0.00s ]

以下文章点击率最高

Loading…


发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注