Introduction to common killing process parameters of pt-kill and parameters of pt-kill

Source: Internet
Author: User

Introduction to common killing process parameters of pt-kill and parameters of pt-kill

Pt-kill is an excellent tool for kill MySQL connection and is part of percona toolkit, when the maximum number of connections is exceeded due to a large number of idle connections and a problematic SQL statement causes a high mysql load, you must kill some connections. This tool is mainly used for this purpose.

1. Press user kill
/Usr/bin/pt-kill -- busy-time 15 -- match-user = "dbUSER1 | dbUSER2 ,... "-- victim all -- interval 1 -- kill -- daemonize -- pid =/tmp/ptkill. pid -- print -- log =/home/pt-kill.log
Note: The test uses user-based thread killing. Note that multiple users of -- match-user are separated by |.


2. Run the query source host kill command.
/Usr/bin/pt-kill -- busy-time 15 -- match-host = "192.168.10.10 | 192.168.10.11" -- victim all -- interval 1 -- kill -- daemonize -- pid =/tmp/ptkill. pid -- print -- log =/home/pt-kill.log
-- Ignore-host/-- match-host

Note: In the test, the thread is killed by the source host. Note that multiple hosts in match-host are separated by |.


3. Press command kill
/Usr/bin/pt-kill -- busy-time 15 -- match-command = "query | Execute" -- victim all -- interval 1 -- kill -- daemonize -- pid =/tmp/ptkill. pid -- print -- log =/home/pt-kill.log
/Usr/bin/pt-kill -- busy-time 15 -- ignore-command = "sleep | binlogdump" -- victim all -- interval 1 -- kill -- daemonize -- pid =/tmp/ptkill. pid -- print -- log =/home/pt-kill.log

Note: In the test, the thread is killed by pressing command. Note that the command content must be case-sensitive. Otherwise, the thread cannot be killed. Note: -- match-command multiple commands are separated by |; otherwise, they will become invalid.
(Commands include Query, Sleep, Binlog Dump, Connect, Delayed insert, Execute, Fetch, Init DB, Kill, Prepare, Processlist, Quit, Reset stmt, and Table Dump)


4. Press state kill
/Usr/bin/pt-kill -- busy-time 15 -- match-state = "Locked | Sending data" -- victim all -- interval 1 -- kill -- daemonize -- pid =/tmp/ ptkill. pid -- print -- log =/home/pt-kill.log
Note: In the test, the thread is killed by pressing state. Note that the state content must strictly match the case. Otherwise, the thread cannot be killed. Note: -- match-state multiple states are separated by |; otherwise, it will become invalid.
(The state types include: locked, login, copy to tmp table, Copying to tmp table, Copying to tmp table on disk, Creating tmp table, executing, Reading from net, Sending data, Sorting for order, Sorting result, Table lock, Updating)


5. Press the info keyword kill.
/Usr/bin/pt-kill -- busy-time 15 -- match-info = "SELECT | DELETE" -- victim all -- interval 1 -- kill -- daemonize -- pid =/tmp/ptkill. pid -- print -- log =/home/pt-kill.log
Note: In the test, the thread is killed by pressing info. Note that the info content must be case-sensitive. Otherwise, the thread cannot be killed. Note: -- match-info multiple info are separated by |; otherwise, it will become invalid.
-- Ignore-info/-- match-info
(Info can be matched using select, update, insert, and delete, and multiple matches can be performed using "|", for example, "select | SELECT | delete | DELETE | update | UPDATE"


6. kill by the accessed dbname
/Usr/bin/pt-kill -- busy-time 15 -- match-db = "db1 | db2" -- victim all -- interval 1 -- kill -- daemonize -- pid =/tmp/ptkill. pid -- print -- log =/home/pt-kill.log
-- Ignore-db/-- match-db
Note: In the test, the thread is killed by db. Note that the content of the db must be case-sensitive. Otherwise, the thread cannot be killed. Note: -- match-db multiple DBs are separated by |; otherwise, it will become invalid.


Also: Action:
-- Kill the connection and exit
-- Kill-query: only the statement executed by the connection is killed, but the thread is not terminated.

Related Article

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.