Installation and use of the percona-toolkit toolkit

 

The original text comes from: http://www.cnblogs.com/zping/p/5678652.html

percona-toolkit is a very practical toolset. I only used some of its functions before, but when I had a chance to get in touch, I found that its functions are very comprehensive, and there are corresponding tools for management, development and monitoring.

1. Check and install modules related to Perl
PT tools are written and executed in Perl language, so a Perl environment is required in the system.
The dependency package check command is: rpm -qa perl-DBI perl-DBD-MySQL perl-Time-HiRes perl-IO-Socket-SSL
If there is a dependency package, you can use the following command to install:
yum install perl-DBI
yum install perl -DBD-MySQL
yum install perl-Time-HiRes
yum install perl-IO-Socket-SSL
wget http://pkgs.repoforge.org/perl-TermReadKey/perl-TermReadKey-2.30-1.el3.rf.x86_64.rpm
rpm -ivh perl-TermReadKey-2.30-1.el3.rf.x86_64.rpm
wget https://www.percona.com/downloads/percona-toolkit/2.2.14/RPM/percona-toolkit-2.2.14-1 .noarch.rpm
rpm -ivh percona-toolkit-2.2.14-1.noarch.rpm
If you can't download: Go directly to the page to download the rpm package:
1, https://centos.pkgs.org/ Search: perl-TermReadKey Download
2 , https://www.percona.com/downloads/ Enter the download page to download
Note: The Term::ReadKey package needs to be installed, otherwise it will report perl(Term::ReadKey) is needed by percona-toolkit-2.2.14-1.noarch
2: Download and install the percona toolkit package
http://pkgs.repoforge .org/perl-TermReadKey/ (key)
https://www.percona.com/downloads/percona-toolkit/ (tool)
After installation, you can use the following command to confirm whether the installation is successful:
# pt-query-digest -- help
# pt-table-checksum --help
If the command prompt can be displayed normally, it means that the pt tool has been installed and used normally.
Some 32 commands can be divided into 7 categories:

The above is an introduction to the basic functions of each command of the pt tool. You can use command --help to view the specific function and usage of each command; for
some commands, you can also use the man command command to query the detailed information of related commands.

At present, the more commonly used commands are: pt-query-digest, pt-kill and other commands.
Add field:
pt-online-schema-change --alter "add column attribute3 varchar(100)" h=192.168.1.142,P=3306,p=cc.123,u=root,D=orabenlai,t=oraesb - -no-check-replication-filters --execute
description: 1. If there is binlog_ignore_db = mysql selection, the check-replication-filters error will be reported, and --no-check-replication-filters
            2 must be added. --execute is preceded by There are 2 "-"
s that list duplicate indexes and primary keys, and print out the delete statement:
pt-duplicate-key-checker -h 172.16.59.99 -u dba_huzj -p 123456 -P 43306 -d eifta
pt-heartbeat check master-slave Delay
creation of heartbeat table:
pt-heartbeat --check -h 172.16.59.99 -u dba_huzj -p 123456 -P 43306 --database=eifta --create-table --master-server-id=16059099
start on master Update table:
pt-heartbeat -D eifta --update -h 172.16.59.99 -u dba_huzj -p 123456 -P 43306 --daemonize
monitor slave latency:
pt-heartbeat --check -D eifta -h 172.16.59.100 -u dba_huzj - p 123456 -P 43306
pt-table-checksum consistency check:
pt-table-checksum --nocheck-replication-filters --no-check-binlog-format --replicate=172.16.59.100 --databases=eifta -h 172.16.59.99 -u dba_huzj -p 123456

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325050001&siteId=291194637