Installation and initial use of Percona-toolkit Toolkit

Source: Internet
Author: User
Tags diff install perl percona


Introduction of Percona-toolkit Tools

The Percona-toolkit, "PT Tool", is a collection of advanced command-line tools for performing various MySQL and system tasks that are complex and cumbersome to perform by hand, including:

Check the consistency of master and slave data

Effectively archive records

Look for Duplicate indexes

Summarizing Server information

Analyze queries from logs and tcpdump

Collect important system information when something goes wrong with the system

Percona-toolkit from the Maatkit and Aspersa tools, the two tools are the most famous tool for managing MySQL, now Maatkit tools are not maintained, please use the Percona-toolkit bar. These tools mainly include development, performance, configuration, monitoring, replication, System, practical six categories, as a good DBA, which tools are very useful, if you can master and flexible application, will greatly improve the efficiency.
Second, Percona-toolkit installation steps and process

My environment is CentOS 6.5 system + MySQL 5.5.35, you can follow the steps below to install the PT tool.

1. Check and install Perl-related modules

The PT tool is written and executed in Perl and requires a Perl environment in the system.

The Dependency Pack Check command is:

Rpm-qa perl-dbi perl-dbd-mysql perl-time-hires Perl-io-socket-ssl

If you have a dependency 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


download and install of 2.percona-toolkit tools

The latest version of PT tool is 2.2.12, which can be downloaded via the following connection:

http://download.csdn.net/detail/yumushui/8379565

You can also download the latest version at the official website:

wget percona.com/get/percona-toolkit.tar.gz

wget percona.com/get/percona-toolkit.rpm

A. Percona-toolkit rpm installation Method

RPM-IVH perl-termreadkey-2.30-1.el5.rf.x86_64.rpm

RPM-IVH percona-toolkit-2.1.1-1.noarch.rpm

Note: The Term::readkey package needs to be installed, otherwise the Perl (Term::readkey) >= 2.10 is needed by Percona-toolkit-2.1.1-1.noarch error will be reported


B. Percona-toolkit Compilation installation Method

Tar xzvf percona-toolkit-2.1.1.tar.gz

CD percona-toolkit-2.1.1

Perl makefile.pl

Make

Make Test

Make install

After installation, you can confirm that the installation was successful by using the following command:

# pt-query-digest--help

# pt-table-checksum--help

If the command prompt is displayed correctly, the PT tool is installed and used properly.


******************************

Here are my specific installation procedures on a single server:

# wget percona.com/get/percona-toolkit.tar.gz--2014-09-16 16:55:46--http://percona.com/get/percona-toolkit.tar.gz Resolving percona.com ... 74.121.199.234 Connecting to percona.com|74.121.199.234|:80 ... 
Connected. HTTP request sent, awaiting response ... 302 Found location:http://www.percona.com/get/percona-toolkit.tar.gz [following]--2014-09-16 16:55:49-- www.percona.com/get/percona-toolkit.tar.gz Resolving www.percona.com ... 
74.121.199.234 reusing existing connection to percona.com:80. HTTP request sent, awaiting response ... 302 Found location:http://www.percona.com/downloads/percona-toolkit/2.2.10/tarball/percona-toolkit-2.2.10.tar.gz [following]--2014-09-16 16:55:57--http://www.percona.com/downloads/percona-toolkit/2.2.10/tarball/ 
Percona-toolkit-2.2.10.tar.gz reusing existing connection to percona.com:80. HTTP request sent, awaiting response ... OK length:1389083 (1.3M) [application/x-gzip] saving to: "Percona-toolkit-2.2.10.tar.gz" 100%[==========================================================================================&GT] 1,389,083 253K/s in 8.0s  2014-09-16 16:56:05 (170 kb/s)-"percona-toolkit-2.2.10.tar.gz" saved [1389083/1389083] # perl makefile.pl Checking if 
Your kit is complete ... Looks good writing Makefile for Percona-toolkit [Root@nagios percona-toolkit-2.2.10]# make CP bin/pt-mysql-summary Blib /script/pt-mysql-summary/usr/bin/perl-mextutils::my-e ' My->fixin (Shift)--blib/script/pt-mysql-summary CP bin/ PT-PMP blib/script/pt-pmp/usr/bin/perl-mextutils::my-e ' my->fixin (Shift) '--blib/script/pt-pmp CP Bin/pt-kill Bli B/script/pt-kill/usr/bin/perl-mextutils::my-e ' My->fixin (Shift)--Blib/script/pt-kill CP bin/ Pt-online-schema-change blib/script/pt-online-schema-change/usr/bin/perl-mextutils::my-e ' MY->fixin (Shift) '-- Blib/script/pt-online-schema-change cp bin/pt-align BLIB/SCRIPT/PT-ALIGN/USR/BIN/PERL-MEXTUTILS::MY-E ' MY-> 
Fixin (Shift) '--blib/script/pt-alignCP bin/pt-heartbeat BLIB/SCRIPT/PT-HEARTBEAT/USR/BIN/PERL-MEXTUTILS::MY-E ' my->fixin (Shift) '--blib/script/ Pt-heartbeat cp bin/pt-table-sync blib/script/pt-table-sync/usr/bin/perl-mextutils::my-e ' MY->fixin (Shift) '--BL Ib/script/pt-table-sync cp bin/pt-upgrade blib/script/pt-upgrade/usr/bin/perl-mextutils::my-e ' MY->fixin (Shift) '--blib/script/pt-upgrade cp bin/pt-table-usage BLIB/SCRIPT/PT-TABLE-USAGE/USR/BIN/PERL-MEXTUTILS::MY-E ' MY->fi Xin (Shift) '--blib/script/pt-table-usage CP bin/pt-slave-delay Blib/script/pt-slave-delay/usr/bin/perl-mextutils:: My-e ' My->fixin (Shift)--blib/script/pt-slave-delay CP bin/pt-sift Blib/script/pt-sift/usr/bin/perl-mextutils:: My-e ' My->fixin (Shift)--blib/script/pt-sift CP Bin/pt-fifo-split Blib/script/pt-fifo-split/usr/bin/perl-mextut Ils::my-e ' My->fixin (Shift)--blib/script/pt-fifo-split CP Bin/pt-slave-find blib/script/pt-slave-find/usr/bin/ Perl-mextutils::my-e ' My->fixin (Shift)'--blib/script/pt-slave-find cp bin/pt-ioprofile BLIB/SCRIPT/PT-IOPROFILE/USR/BIN/PERL-MEXTUTILS::MY-E ' MY->fix In (Shift)--blib/script/pt-ioprofile cp bin/pt-diskstats BLIB/SCRIPT/PT-DISKSTATS/USR/BIN/PERL-MEXTUTILS::MY-E ' my ->fixin (Shift) '--blib/script/pt-diskstats cp bin/pt-find BLIB/SCRIPT/PT-FIND/USR/BIN/PERL-MEXTUTILS::MY-E ' MY-& Gt;fixin (Shift) '--blib/script/pt-find cp bin/pt-archiver BLIB/SCRIPT/PT-ARCHIVER/USR/BIN/PERL-MEXTUTILS::MY-E ' MY- >fixin (Shift) '--blib/script/pt-archiver CP Bin/pt-deadlock-logger Blib/script/pt-deadlock-logger/usr/bin/perl- Mextutils::my-e ' My->fixin (Shift)--Blib/script/pt-deadlock-logger CP Bin/pt-fingerprint blib/script/ Pt-fingerprint/usr/bin/perl-mextutils::my-e ' My->fixin (Shift)--blib/script/pt-fingerprint CP bin/ Pt-visual-explain blib/script/pt-visual-explain/usr/bin/perl-mextutils::my-e ' MY->fixin (Shift) '--blib/script/ Pt-visual-explain CP Bin/pt-variable-advisor Blib/script/pt-vaRiable-advisor/usr/bin/perl-mextutils::my-e ' My->fixin (Shift)--blib/script/pt-variable-advisor CP Bin/pt-mext Blib/script/pt-mext/usr/bin/perl-mextutils::my-e ' My->fixin (Shift)--blib/script/pt-mext CP Bin/pt-index-usage Blib/script/pt-index-usage/usr/bin/perl-mextutils::my-e ' My->fixin (Shift)--blib/script/pt-index-usage CP bin/ Pt-slave-restart blib/script/pt-slave-restart/usr/bin/perl-mextutils::my-e ' my->fixin (Shift) '--blib/script/ Pt-slave-restart cp bin/pt-summary blib/script/pt-summary/usr/bin/perl-mextutils::my-e ' MY->fixin (Shift) '--blib /script/pt-summary CP bin/pt-duplicate-key-checker Blib/script/pt-duplicate-key-checker/usr/bin/perl-mextutils:: My-e ' My->fixin (Shift)--blib/script/pt-duplicate-key-checker CP Bin/pt-fk-error-logger blib/script/ Pt-fk-error-logger/usr/bin/perl-mextutils::my-e ' My->fixin (Shift)--Blib/script/pt-fk-error-logger CP bin/ Pt-table-checksum Blib/script/pt-table-checksum/usr/bin/perl -mextutils::my-e ' My->fixin (Shift)--blib/script/pt-table-checksum CP bin/pt-query-digest blib/script/ Pt-query-digest/usr/bin/perl-mextutils::my-e ' My->fixin (Shift)--blib/script/pt-query-digest CP bin/ Pt-show-grants blib/script/pt-show-grants/usr/bin/perl-mextutils::my-e ' my->fixin (Shift) '--blib/script/ pt-show-grants cp Bin/pt-config-diff blib/script/pt-config-diff/usr/bin/perl-mextutils::my-e ' MY->fixin (Shift) ' --Blib/script/pt-config-diff CP bin/pt-stalk BLIB/SCRIPT/PT-STALK/USR/BIN/PERL-MEXTUTILS::MY-E ' MY->fixin (shift ) '--blib/script/pt-stalk manifying blib/man1/pt-mysql-summary.1p manifying blib/man1/pt-kill.1p Manifying pt-online-schema-change.1p manifying blib/man1/pt-table-sync.1p manifying blib/man1/pt-upgrade.1p Manifying man1/pt-table-usage.1p manifying blib/man1/pt-fifo-split.1p manifying blib/man1/pt-slave-find.1p Manifying /pt-ioprofile.1p manifying blib/man1/pt-find.1p manifying blib/man1/pt-archiver.1p manifying blib/man1/pt-deadlock-logger.1p manifying blib/man1/pt-fingerprint.1p Manifying pt-mext.1p manifying blib/man1/pt-slave-restart.1p manifying blib/man1/pt-summary.1p Manifying pt-fk-error-logger.1p manifying blib/man1/pt-table-checksum.1p manifying blib/man1/pt-query-digest.1p Manifying /man1/pt-show-grants.1p manifying blib/man1/percona-toolkit.1p manifying blib/man1/pt-pmp.1p Manifying 
pt-align.1p manifying blib/man1/pt-heartbeat.1p manifying blib/man1/pt-slave-delay.1p Manifying Manifying blib/man1/pt-diskstats.1p manifying blib/man1/pt-visual-explain.1p manifying blib/man1/ 
pt-variable-advisor.1p manifying blib/man1/pt-index-usage.1p manifying blib/man1/pt-duplicate-key-checker.1p manifying blib/man1/pt-config-diff.1p manifying blib/man1/pt-stalk.1p [Root@nagios percona-toolkit-2.2.10]# # [Root@n Agios percona-toolkit-2.2.10]# make test No tests defined for Percona-toolkit extension. [Root@nagios percona-toolkit-2.2.10]# [Root@nagios percona-toolkit-2.2.10]# make install installing/usr/local/share/ man/man1/pt-summary.1p installing/usr/local/share/man/man1/pt-ioprofile.1p installing/usr/local/share/man/man1/ pt-query-digest.1p installing/usr/local/share/man/man1/pt-sift.1p installing/usr/local/share/man/man1/ pt-align.1p installing/usr/local/share/man/man1/pt-find.1p installing/usr/local/share/man/man1/ pt-table-checksum.1p installing/usr/local/share/man/man1/pt-slave-restart.1p Installing/usr/local/share/man/man1 /pt-duplicate-key-checker.1p installing/usr/local/share/man/man1/pt-stalk.1p Installing/usr/local/share/man/man1 /pt-fk-error-logger.1p installing/usr/local/share/man/man1/pt-config-diff.1p Installing/usr/local/share/man/man1 /pt-table-usage.1p installing/usr/local/share/man/man1/pt-diskstats.1p installing/usr/local/share/man/man1/ pt-visual-explain.1p installing/usr/local/share/man/man1/pt-show-grants.1p installing/usr/local/share/man/man1/pt-kill.1p installing/usr/local/share/man/man1/pt-archiver.1p installing/usr/local/share/man/ man1/pt-upgrade.1p installing/usr/local/share/man/man1/pt-mext.1p installing/usr/local/share/man/man1/ pt-slave-delay.1p installing/usr/local/share/man/man1/pt-heartbeat.1p installing/usr/local/share/man/man1/ pt-mysql-summary.1p installing/usr/local/share/man/man1/pt-online-schema-change.1p installing/usr/local/share/ man/man1/pt-fifo-split.1p installing/usr/local/share/man/man1/pt-variable-advisor.1p installing/usr/local/share/ man/man1/pt-slave-find.1p installing/usr/local/share/man/man1/pt-fingerprint.1p installing/usr/local/share/man/ man1/percona-toolkit.1p installing/usr/local/share/man/man1/pt-pmp.1p installing/usr/local/share/man/man1/ pt-deadlock-logger.1p installing/usr/local/share/man/man1/pt-index-usage.1p installing/usr/local/share/man/man1/ pt-table-sync.1p Installing/usr/local/bin/pt-variable-advisor installing/usr/local/bin/pt-visual-explain Installing/usr/local/bin/pt-slave-restart installing/usr/local/bin/pt-align installing/usr/local/bin/ 
Pt-fk-error-logger Installing/usr/local/bin/pt-duplicate-key-checker Installing/usr/local/bin/pt-heartbeat 
Installing/usr/local/bin/pt-table-usage Installing/usr/local/bin/pt-upgrade Installing/usr/local/bin/pt-archiver 
Installing/usr/local/bin/pt-find Installing/usr/local/bin/pt-kill Installing/usr/local/bin/pt-ioprofile Installing/usr/local/bin/pt-query-digest Installing/usr/local/bin/pt-slave-delay installing/usr/local/bin/ Pt-fingerprint installing/usr/local/bin/pt-table-checksum installing/usr/local/bin/pt-summary installing/usr/ 
LOCAL/BIN/PT-PMP Installing/usr/local/bin/pt-fifo-split Installing/usr/local/bin/pt-online-schema-change 
Installing/usr/local/bin/pt-slave-find Installing/usr/local/bin/pt-table-sync Installing/usr/local/bin/pt-stalk Installing/usr/local/bin/pt-diskstats Installing/usr/local/bin/pt-sift Installing/usR/local/bin/pt-show-grants installing/usr/local/bin/pt-mysql-summary Installing/usr/local/bin/pt-config-diff Installing/usr/local/bin/pt-index-usage Installing/usr/local/bin/pt-deadlock-logger installing/usr/local/bin/ Pt-mext appending installation Info to/usr/lib64/perl5/perllocal.pod [Root@nagios percona-toolkit-2.2.10]# [Root@nagi OS percona-toolkit-2.2.10]#




Iii. Overview of the overall classification and function of the Percona-toolkit command


After the latest PT 2.2.12 version is installed, there is a total of the following commands:

# pwd
/usr/local/percona-toolkit-2.2.12/bin
#
# LL
Total 5352
-rwxrwxr-x 1 1000 1000 40852 Nov 21:36
-rwxrwxr-x 1 1000 1000 247292 Nov 21:36
-rwxrwxr-x 1 1000 1000 166888 Nov 21:36
-rwxrwxr-x 1 1000 1000 164033 Nov 21:36
-rwxrwxr-x 1 1000 1000 163722 Nov 21:36
-rwxrwxr-x 1 1000 1000 166921 Nov 21:36
-rwxrwxr-x 1 1000 1000 49262 Nov 21:36
-rwxrwxr-x 1 1000 1000 148347 Nov 21:36
-rwxrwxr-x 1 1000 1000 66409 Nov 21:36
-rwxrwxr-x 1 1000 1000 131003 Nov 21:36
-rwxrwxr-x 1 1000 1000 190538 Nov 21:36
-rwxrwxr-x 1 1000 1000 224641 Nov 21:36
-rwxrwxr-x 1 1000 1000 32276 Nov 21:36
-rwxrwxr-x 1 1000 1000 245236 Nov 21:36
-rwxrwxr-x 1 1000 1000 21684 Nov 21:36
-rwxrwxr-x 1 1000 1000 100494 Nov 21:36
-rwxrwxr-x 1 1000 1000 368714 Nov 21:36
-rwxrwxr-x 1 1000 1000 24525 Nov 21:36
-rwxrwxr-x 1 1000 1000 516529 Nov 21:36
-rwxrwxr-x 1 1000 1000 72384 Nov 21:36
-rwxrwxr-x 1 1000 1000 37651 Nov 21:36
-rwxrwxr-x 1 1000 1000 144190 Nov 21:36
-rwxrwxr-x 1 1000 1000 125951 Nov 21:36
-rwxrwxr-x 1 1000 1000 178193 Nov 21:36
-rwxrwxr-x 1 1000 1000 69227 Nov 21:36
-rwxrwxr-x 1 1000 1000 89799 Nov 21:36
-rwxrwxr-x 1 1000 1000 409966 Nov 21:36
-rwxrwxr-x 1 1000 1000 394568 Nov 21:36
-rwxrwxr-x 1 1000 1000 222447 Nov 21:36
-rwxrwxr-x 1 1000 1000 328098 Nov 21:36
-rwxrwxr-x 1 1000 1000 175665 Nov 21:36
-rwxrwxr-x 1 1000 1000 101492 Nov 21:36
#
# ls | Wc
32 32 455


The existing 32 commands can be divided into 7 main categories:

Tool category

Tools command

Tool action

Remarks /p>

Development class

Pt-duplicate-key-checker

Lists and deletes duplicate indexes and Foreign key


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.