前段时间一个项目的mysql进程发生堵塞,导致load很高,甚至导致mysql连接web层失败。解决的方法有两种方法,一个是:杀进程,另一个方法是重启mysql。经过考虑,应为堵塞,有风险导致mysql重启会起不来,决定使用杀进程这种方法。
这个方法也是有一定的问题。应为有进程完成,有进程未完成,所以导致无法批量删除,只能手动删除,如果堵塞的进程很多,会很烦。
查看进程:
mysql> show processlist;+---------+------+--------------------+--------------+---------+------+-------+------------------+| Id | User | Host | db | Command | Time | State | Info |+---------+------+--------------------+--------------+---------+------+-------+------------------+| 1628036 | root | 172.17.63.19:45336 | xdf_wechat | Sleep | 16 | | NULL || 1628166 | root | 172.17.63.19:45348 | xdf_wechat | Sleep | 20 | | NULL || 1628962 | root | 172.17.63.19:45471 | xdf_platform | Sleep | 20 | | NULL || 1629587 | root | 172.17.63.19:45855 | xdf_platform | Sleep | 20 | | NULL || 1629693 | root | 172.17.63.19:46018 | xdf_wechat | Sleep | 8 | | NULL || 1629721 | root | 172.17.63.19:46071 | xdf_wechat | Sleep | 17 | | NULL || 1629901 | root | 172.17.63.19:46330 | xdf_wechat | Sleep | 18 | | NULL || 1629902 | root | 172.17.63.19:46332 | xdf_wechat | Sleep | 18 | | NULL || 1631017 | root | 172.17.63.19:47559 | xdf_wechat | Sleep | 18 | | NULL || 1631094 | root | 172.17.63.19:47645 | xdf_wechat | Sleep | 0 | | NULL || 1631095 | root | 172.17.63.19:47646 | xdf_wechat | Sleep | 19 | | NULL || 1631097 | root | 172.17.63.19:47647 | xdf_wechat | Sleep | 10 | | NULL || 1631254 | root | localhost | NULL | Query | 0 | NULL | show processlist |+---------+------+--------------------+--------------+---------+------+-------+------------------+13 rows in set (0.00 sec)
手动杀
kill ID;
解决问题。
联系客服