In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
What is the use of pt-kill in Percona-Toolkit? many beginners are not very clear about it. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can get something.
In the production environment, we often encounter such a situation, the database performance is poor, we need to kill part of the session immediately, otherwise the database will be rammed to death. We can first find show processlist's output to kill the conversation, but it is more troublesome. Pt-kill solved the problem of killing conversation for us.
1. Check every 10 seconds and kill the process that finds Query.
# only print and check every 10 seconds: (--interval 10)
Pt-kill-host=192.168.5.7-port=3306-user=root-password=hankyoon-match-command= "Query"-busy-time 30-victims all-interval 10-daemonize-print-log=/tmp/1.log
# perform kill operation and print log:
Pt-kill-host=192.168.5.7-port=3306-user=root-password=hankyoon-match-command= "Query"-busy-time 30-victims all-interval 10-daemonize-kill-log=/tmp/kill.log
2. Check and kill sessions whose select is greater than 30s.
# only print select greater than 30s:
Pt-kill-host=192.168.5.7-port=3306-user=root-password=hankyoon-match-info "select | SELECT"-busy-time 30-victims all-interval 10-daemonize-print-log=/tmp/pt_select.log
# perform a kill operation with a select greater than 30s:
Pt-kill-host=192.168.5.7-port=3306-user=root-password=hankyoon-match-info "select | SELECT"-busy-time 30-victims all-interval 10-daemonize-kill-log=/tmp/pt_select_kill.log
# execute kill operation for yoon library select greater than 30s:
Pt-kill-host=192.168.5.7-- port=3306-- user=root-- password=hankyoon-- match-db='yoon'-- match-info "select | SELECT"-- busy-time 30-- victims all-- interval 10-- daemonize-- kill-- log=/tmp/pt_select_yoon_kill.log
3. Check and kill the conversation of an IP source
# only print sessions from a certain IP source
Pt-kill-host=192.168.5.7-- port=3306-- user=root-- password=hankyoon-- match-host "192.168.5.7"-- busy-time 30-- victims all-- interval 10-- daemonize-- print-- log=/tmp/pt_select.log
# execute a session of an IP source
Pt-kill-host=192.168.5.7-- port=3306-- user=root-- password=hankyoon-- match-host "192.168.5.7"-- busy-time 30-- victims all-- interval 10-- daemonize-- kill-- log=/tmp/pt_select_kill.log
4. Check and access a user's session
# only print kill to access a user's session
Pt-kill-host=192.168.5.7-port=3306-user=root-password=hankyoon-match-user "yoon"-busy-time 30-victims all-interval 10-daemonize-print-log=/tmp/pt_select.log
# perform kill operation-check and access a user's session
Pt-kill-host=192.168.5.7-port=3306-user=root-password=hankyoon-match-user "yoon"-busy-time 30-victims all-interval 10-daemonize-kill-log=/tmp/pt_select_kill.log
5. Kill the sql that is in progress of filesort
# print only-kill the sql that is in progress with filesort
Pt-kill-host=192.168.5.7-port=3306-user=root-password=hankyoon-match-db='db'-match-command Query-match-state "Sorting result"-run-time 1-busy-time 30-victims all-interval 10-daemonize-print-log=/tmp/pt_select.log
# execute kill operation-kill the sql that is in the process of filesort
Pt-kill-host=192.168.5.7-port=3306-user=root-password=hankyoon-match-db='db'-match-command Query-match-state "Sorting result"-run-time 1-busy-time 30-victims all-interval 10-daemonize-kill-log=/tmp/pt_select_kill.log
# print only
Pt-kill-host=192.168.5.7-port=3306-user=root-password=hankyoon-match-db='db'-match-command Query-match-state "Creating sort index"-run-time 1-busy-time 30-victims all-interval 10-daemonize-print-log=/tmp/pt_select.log
# perform kill operation
Pt-kill-host=192.168.5.7-port=3306-user=root-password=hankyoon-match-db='db'-match-command Query-match-state "Creating sort index"-run-time 1-busy-time 30-victims all-interval 10-daemonize-kill-log=/tmp/pt_select_kill.log
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.