Skip to content

Instantly share code, notes, and snippets.

@khanhtran3005
Last active June 28, 2019 08:04
Show Gist options
  • Save khanhtran3005/cc66bc07d457c948302b4f9b745d58b6 to your computer and use it in GitHub Desktop.
Save khanhtran3005/cc66bc07d457c948302b4f9b745d58b6 to your computer and use it in GitHub Desktop.
pt-kill example

pt-kill user must have SUPER PROCESS permission.

The following command intends to kill queries which have execute time greater than 30s and save terminated queries to database.

pt-kill --host=localhost --user=pt_kill_user --password=pt_kill_pass \
--busy-time=30 --interval=5s \
--log-dsn=h=localhost,D=pt_kill,t=kill_log,P=3306,u=root,p=root \
--kill --daemonize --ignore-user=backup

or

pt-kill --busy-time 30 --kill --daemonize \
--user pt_kill_user --ask-pass --print \
--log-dsn "D=ws_mail,t=kill_log,h=10.140.0.4" \
--ignore-user "(backup|root)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment