1. Download percona-toolkit-2.2.16.tar.gz
# wget
Https://www.percona.com/downloads/percona-toolkit/2.2.16/tarball/percona-toolkit-2.2.16.tar.gz
2. Installation
# LL
-rw-r--r--1 root root 1408239 November 9 percona-toolkit-2.2.16.tar.gz
# Tar XF percona-toolkit-2.2.16.tar.gz
# CD percona-toolkit-2.2.16
# Perl makefile.pl
# yum-y Install Perl
# yum-y Install perl-extutils-makemaker.x86_64
# yum-y Install perl-dbi.x86_64
# yum-y Install perl-dbd-mysql.x86_64
# Perl makefile.pl
# make
# make Install
# yum-y Install perl-time-hires.x86_64
#/usr/local/bin/pt-kill-s/tmp/mysql.sock-u root-p "123456" \
--match-info "^ (select| Select| Select) "\
--busy-time 5--victim All--interval 3--kill-query--print \
--log/usr/local/src/kill.txt--daemonize
--socket=s-s socket file to use for connection
--user=s-u user for Login if not current user
--password=s-p password to use when connecting
--match-info=s match only queries whose info (query) matches this Perl regex
--busy-time=m Match queries that has been running for longer than
This time. Optional suffix s=seconds, m=minutes, h=
Hours, d=days; If no suffix, S is used.
--interval=m how often to check for queries to kill. Optional
Suffix s=seconds, m=minutes, h=hours, d=days; If no
Suffix, S is used.
--victims=s which of the matching queries in each class would be
Killed (default oldest)
Actions:
--execute-command=s execute this command when a query matches
--kill kill the connection for matching queries
--kill-query Kill matching Queries
--print print a KILL statement for matching queries; does not
Actually kill queries
--log=s Print All output to this file when daemonized
--daemonize Fork to the background and detach from the shell
Percona-toolkit Kill Slow SQL statements