Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Percona-toolkit kills slow SQL statements

2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

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 2015 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 have been running for longer than

This time. Optional suffix s=seconds, m=minutes, h =

Hours, dumbdays; if no suffix, s is used.

-- interval=m How often to check for queries to kill. Optional

Suffix s=seconds, m=minutes, h=hours, dumbdays; if no

Suffix, s is used.

-- victims=s Which of the matching queries in each class will 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

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report