温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

percona-toolkit 杀死慢的SQL语句

发布时间:2020-06-27 17:39:39 来源:网络 阅读:567 作者:PeterWang2018 栏目:数据库

1、下载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、安装

# ll

-rw-r--r-- 1 root root 1408239 11月  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, d=days; if no suffix, s is used.


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

                         suffix s=seconds, m=minutes, h=hours, d=days; 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



向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI