Home > Database > Mysql Tutorial > body text

mysql环境下批量kill Locked进程_MySQL

WBOY
Release: 2016-06-01 13:30:48
Original
1193 people have browsed it

bitsCN.com

mysql环境批量kill Locked进程

 

 周末同事告知某台mysql服务器连接数爆满,登录上去,发现连接数满。shou processlist 发现大量的 insert itno table_name values(xxx,xxx) 被Locked。那就批量kill掉

 

[root@ ~]# mysql -ss -e "show processlist" | grep &#39;Locked&#39; | awk &#39;{print "kill "$1";"}&#39; >kill.sql  [root@ ~]# mysql -uroot -ppasswd <kill.sql
Copy after login

kill完发现insert 语句又快速增加,这样初步判断应该是有大数据操作,花费大量时间,那就查一下当前线程连接时间

mysql>  select * from information_schema.processlist  order by time ; 
Copy after login

 

这里连接时间过长的sql语句就值得怀疑了。这样就轻松找到了原因。

 

bitsCN.com
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!