此工具要求用户 ptcheck 对所检查的库或表有读权限和对 ptcheck.checksum 有写权限 ,有在 ptcheck 库中创建表的权限
根据提示输入密码就会开始进行检查
代码语言:javascript复制Note: 此时指定的host要是master
Note: pt-table-checksum 需要 Term::ReadKey 的支持,如果缺少,会报下面的错误
12-15T14:22:37 Cannot read response; is Term::ReadKey installed? Can't locate Term/ReadKey.pm in @INC (@INC contains: /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 .) at /usr/bin/pt-table-checksum line 2612.
解决方法是安装这个包
代码语言:javascript复制[root@opti-master checkdb]# yum install perl-TermReadKey.x86_64
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* epel: mirrors.ustc.edu.cn
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package perl-TermReadKey.x86_64 0:2.30-4.el5 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
=========================================================================================================================
Package Arch Version Repository Size
=========================================================================================================================
Installing:
perl-TermReadKey x86_64 2.30-4.el5 epel 32 k
Transaction Summary
=========================================================================================================================
Install 1 Package(s)
Upgrade 0 Package(s)
Total download size: 32 k
Is this ok [y/N]: y
Downloading Packages:
perl-TermReadKey-2.30-4.el5.x86_64.rpm | 32 kB 00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : perl-TermReadKey 1/1
Installed:
perl-TermReadKey.x86_64 0:2.30-4.el5
Complete!
[root@opti-master checkdb]#