The PT (Percona Toolkit) tool is a Perl-written toolset developed by Percona, which contains a number of features, such as changing data table structures online, validating master-slave data, checking database status, analyzing slow queries, and so on, which are more cumbersome to do by hand. , easy to operate.
Installation
Since it is a tool set for Perl language development, it is of course to install Perl dependent packages first.
Yum install-y perl perl-io-socket-ssl perl-dbd-mysql perl-time-hires PERL-DIGEST-MD5
Then, go to the following link to download the latest version of it, is temporarily Linux version, no windows
https://www.percona.com/downloads/percona-toolkit/
or download the installation under a Linux system:
#先下载Percona toolkit tool to compile package wget "https://www.percona.com/downloads/percona-toolkit/2.2.20/tarball/ Percona-toolkit-2.2.20.tar.gz "#解压tar xf percona-toolkit-2.2.20.tar.gz #进入目录安装cd percona-toolkit-2.2.20.tar.gz #开始编译安装perl Makefile.PL make make install #安装完了就有命令了ll /usr/local/bin/pt-*-r-xr-xr-x 1 root root 41480 Jan 19 11:03 /usr/local/bin/pt-align-r-xr-xr-x 1 root root 263438 jan 19 11:03 /usr/local/bin/pt-archiver-r-xr-xr-x 1 Root root 168985 jan 19 11:03 /usr/local/bin/pt-config-diff-r-xr-xr-x 1 root root 166210 jan 19 11:03 /usr/local/bin/pt-deadlock-logger-r-xr-xr-x 1 root root 164927 jan 19 11:03 /usr/local/bin/pt-diskstats-r-xr-xr-x 1 root root 168895 jan 19 11:03 /usr/local/bin/pt-duplicate-key-checker-r-xr-xr-x 1 root root 49890 jan 19 11:03 /usr/local/bin/pt-fifo-split-r-xr-xr-x 1 root root 149727 jan 19 11:03 /usr/local/bin/pt-find-r-xr-xr-x 1 root root 67037 jan 19 11:03 /usr/local/bin/pt-fingerprint-r-xr-xr-x 1 root root 133187 jan 19 11:03 /usr/local/bin/ pt-fk-error-logger-r-xr-xr-x 1 root root 218381 jan 19 11:03 /usr/ local/bin/pt-heartbeat-r-xr-xr-x 1 root root 226009 jan 19 11:03 /usr/ local/bin/pt-index-usage-r-xr-xr-x 1 root root 32345 jan 19 11:03 /usr/local/bin/pt-ioprofile-r-xr-xr-x 1 root root 250059 jan 19 11:03 /usr/local/bin/pt-kill-r-xr-xr-x 1 root root 21753 jan 19 11:03 /usr/local/bin/pt-mext-r-xr-xr-x 1 Root root 102147 jan 19 11:03 /usr/local/bin/pt-mysql-summary-r-xr-xr-x 1 root root 393892 jan 19 11:03 /usr/local/bin/ pt-online-schema-change-r-xr-xr-x 1 root root 24594 jan 19 11:03 /usr/local/bin/pt-pmp-r-xr-xr-x 1 root root 520502 Jan 19 11:03 /usr/local/bin/pt-query-digest-r-xr-xr-x 1 root root 75713 jan 19 11:03 /usr/local/bin/pt-show-grants-r-xr-xr-x 1 root root 37724 jan 19 11:03 /usr/local/bin/pt-sift-r-xr-xr-x 1 root root 145553 jan 19 11:03 /usr/local/bin/pt-slave-delay-r-xr-xr-x 1 root root 128910 Jan 19 11:03 /usr/local/bin/pt-slave-find-r-xr-xr-x 1 root root 181316 jan 19 11:03 /usr/local/bin/ pt-slave-restart-r-xr-xr-x 1 root root 69580 jan 19 11:03 /usr/ Local/bin/pt-stalk-r-xr-xr-x 1 root root 90418 jan 19 11:03 /usr /local/bin/pt-summary-r-xr-xr-x 1 root root 422772 jan 19 11:03 /usr/ local/bin/pt-table-checksum-r-xr-xr-x 1 root root 398202 jan 19 11:03 /usr/local/bin/pt-table-sync-r-xr-xr-x 1 root root 246864 jan 19 11:03 /usr/local/bin/pt-table-usage-r-xr-xr-x 1 root root 330806 Jan 19 11:03 /usr/local/bin/pt-upgrade-r-xr-xr-x 1 root root 177020 jan 19 11:03 /usr/local/bin/pt-variable-advisor-r-xr-xr-x 1 root root 102278 jan 19 11:03 /usr/local/bin/pt-visual-Explain
So even if the installation is complete, it is very simple.
Just a simple test.
#mysql服务状态摘要pt-mysql-summary --user=root --password= ' 123 ' Mysql: [warning] using a password on the command line interface can be insecure.# percona toolkit mysql summary report ####################### System time | 2017-01-19 10:48:39 utc (local tz: cst +0800) # instances ############################# ##################### port data directory nice oom socket ===== ========================== ==== === ====== 3306 /data/mysql/data 0 0 /tmp/mysql.sock# mysql executable ########################################### path to executable | /usr/local/Percona-Server-5.7.15-9-Linux.x86_64.ssl101/bin/mysqld has symbols | yes# report on Port 3306 ######################################## user | [email protected]% Time | 2017-01-19 18:48:39 (CST) Hostname | beifen1 version | 5.7.15-9-log Percona Server (GPL), release 9, revision 9f0fd0a built on | linux x86_64 Started | 2017-01-18 16:07 (up 1+02:41:11) Databases | 8 Datadir | /data/mysql/data/ Processes | 6 connected, 1 running Replication | Is a slave, has 0 Slaves connected pidfile | /data/mysql/data/beifen1.pid (exists) # processlist ######################## ########################.... Omit a long list of
OK, normal, other features please see the next article
PT (Percona Toolkit) tool Detailed: (i) installation