I. Checking and installing Perl-related modules
The PT tool is written and executed in the Perl language, so you need a Perl environment in your system.
The dependent Package Check command is: rpm -qa perl-dbi perl-dbd-mysql perl-time-hires Perl-io-socket-ssl
If you do have a dependent package, you can install it using the following command: Yum install PERL-DBI
Yum Install Perl-dbd-mysql
Yum Install Perl-time-hires
Yum Install Perl-io-socket-ssl
two. Download and install the Percona Toolkit package
1. download and install the Percona Toolkit package
Reference: Https://www.percona.com/doc/percona-toolkit/3.0/installation.html#installing-percona-toolkit-on-red-hat-or-centos
Yum Install http://www.percona.com/downloads/percona-release/redhat/0.1-4/percona-release-0.1-4.noarch.rpm
2. View the packages that can be installed
Yum List | grep Percona-toolkit
3. Install Percona-toolkit Kit
Yum Install Percona-toolkit
4, after installation, you can confirm the installation success by the following command:
# pt-query-digest--help
If the command prompt is displayed correctly, the PT tool is installed and used properly.
There are 32 commands that can be divided into 7 major categories
Tool categories |
Tool commands |
Tool function |
Note |
Development class |
Pt-duplicate-key-checker |
List and delete duplicate indexes and foreign keys |
|
Pt-online-schema-change |
Modify Table Structure Online |
|
Pt-query-advisor |
Parse query statements and give suggestions, bugs |
IS obsolete |
Pt-show-grants |
Normalize and Print permissions |
|
Pt-upgrade |
Execute queries on multiple servers and compare different |
|
Performance class |
Pt-index-usage |
Analyze index usage in logs and report |
|
Pt-pmp |
Track the query results and summarize the trace results |
|
Pt-visual-explain |
Formatting execution plans |
|
Pt-table-usage |
Query and analyze table usage in the analysis log |
PT 2.2 New command |
Configuration class |
Pt-config-diff |
Comparing configuration files and parameters |
|
Pt-mysql-summary |
Summarize MySQL configuration and status |
|
Pt-variable-advisor |
Analyze the parameters and make recommendations |
|
Monitoring class |
Pt-deadlock-logger |
Extracting and recording MySQL deadlock information |
|
Pt-fk-error-logger |
Extracting and recording foreign key information |
|
Pt-mext |
View status sample information in parallel |
|
Pt-query-digest |
Analyze query logs and generate reports |
Common commands |
Pt-trend |
Read slow log information by time period |
IS obsolete |
Copy class |
Pt-heartbeat |
Monitoring MySQL Replication latency |
|
Pt-slave-delay |
Set the time from the fallen master |
|
Pt-slave-find |
Find and print all MySQL replication hierarchy relationships |
|
Pt-slave-restart |
Monitor salve errors and try restarting Salve |
|
Pt-table-checksum |
Verifying master-Slave Replication consistency |
|
Pt-table-sync |
Efficient synchronization of table data |
|
System class |
Pt-diskstats |
View system disk Status |
|
Pt-fifo-split |
Simulate cutting files and outputting |
|
Pt-summary |
Collection and display System overview |
|
Pt-stalk |
Collect diagnostic data when a problem occurs |
|
Pt-sift |
Browse for files created by Pt-stalk |
PT 2.2 New command |
Pt-ioprofile |
Querying the process IO and printing an IO activity table |
PT 2.2 New command |
Practical class |
Pt-archiver |
Archive table data to another table or file |
|
Pt-find |
Find tables and Execute commands |
|
Pt-kill |
Kill the Eligible SQL |
Common commands |
Pt-align |
Aligning the output of other tools |
PT 2.2 New command |
Pt-fingerprint |
Turn queries into ciphertext |
PT 2.2 New command |
Installation of the "Linux" Percona-toolkit Toolkit