pt-kill MySQL session kill artifact

 

 

 

Ado, directly on the examples:

pt-kill --host=127.0.0.1 --user=xxx --password=xxxxxx --port=xxxx --busy-time 10 --match-info="SELECT * FROM|DELETE FROM XXX" --victim all --interval 5 \
--daemonize --pid=/tmp/ptkill.pid --log=/tmp/pt-kill.log --kill --print

 

Some of the options Interpretation:

--match-xxx show processlist corresponding to the fields of:

+---------+-------------+------------------+---------+------------------+--------+---------------------------------------------------------------+------------------+
| Id      | User        | Host             | db      | Command          | Time   | State                                                         | Info             |
+---------+-------------+------------------+---------+------------------+--------+---------------------------------------------------------------+------------------+

--busy-time 15 match has been running for more than this time (in seconds) queries. Queries must be in Command = Query status. This report SHOW PROCESSLIST Time value matches the query.

--kill-busy-commands --busy-time only connection Query Command = match, certain slow SQL Command = Execute, this time using --kill-busy-commands = Query, Execute

--match-user = "nice | dbuser01 | dbuser02" according to the user session kill

--match-host = "10.10.1.1 | 10.10.1.2" kill the host session by session connection

--match-db = "" kill matching session according db

--match-command = "Query | Execute " in accordance with the command to kill the matching session, (Command value there: Query, at Sleep, Binlog Dump, Connect, the DelayedPause signal INSERT, the Execute
Fetch, the Init DB, Kill, the Prepare, processlist, the Quit, the Reset stmt, Table Dump)

--match-state 按照state杀会话,(State取值有,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)

--match-info = "" only match the Info column with this Perl regular expression matching the query. Info column displays a list of processes the query is executed, if no query is executed, the display NULL.

--match-all match all non-negligible (--ignore specified) query (except copy thread unless specified --replication-threads), can be combined with --victim, such as: - match-all --victim oldest, only kill the oldest inquiry

--victim 【 oldest | all | all-but-oldest 】

  • oldest kill the longest execution time that a SQL
  • all kill all matching SQL
  • all-but-oldest in addition to performing the longest piece of SQL, all other matches SQL kill (opposite to the oldest)

--print print matching SQL, kill operation is not performed

--kill, kill connection

--kill-query only kill query, do not disconnect

--daemonize background

--log, - when daemonize (daemon) is started, all output print this file

--pid create a pid file

Frequency --interval, check and kill the in seconds

 

Note: When you kill a thread matching the content must match exactly the case , otherwise it will not kill. Note that with more than one match between | separated, otherwise it will fail.

 

Guess you like

Origin www.cnblogs.com/waynechou/p/pt-kill.html