Batch kill Locked processes in mysql Environment

Source: Internet
Author: User

Mysql environment batch kill Locked process weekend colleagues told a mysql server that the number of connections is full, login, found that the number of connections is full. Shou processlist found that a large number of insert itno table_name values (xxx, xxx) are Locked. Kill them in batches.

[Root @ ~] # Mysql-ss-e "show processlist" | grep 'locked' | awk' {print "kill" $1 ";"} '> kill. SQL [root @ ~] # Mysql-uroot-ppasswd <kill. SQL

 

After kill, we can find that the insert statement is increasing rapidly. In this way, we can preliminarily determine that there is a large data operation, which takes a lot of time, so we can check the connection time of the current thread.
Mysql> select * from information_schema.processlist order by time;

 

The SQL statements that have been connected for too long are doubtful. This makes it easy to find the cause.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.