故障排查
1 找到正处于open状态的表
show open tables where in_use >=1;
2 找到引发故障的慢查询
① 找到阻塞flush tables的慢查询
SELECT * FROM information_schema.PROCESSLIST
WHERE info IS NOT NULL
AND state NOT LIKE ‘Waiting for table flush’
AND info NOT LIKE ‘SELECT * FROM information_schema.PROCESSLIST
%’
AND INFO LIKE ‘%处于打开状态的表名%’
ORDER BY TIME DESC
② 找到flush tables慢查询
SELECT * FROM information_schema.PROCESSLIST
WHERE info LIKE ‘%flush tables%’
AND info NOT LIKE ‘SELECT * FROM information_schema.PROCESSLIST
%’
3 故障处理
杀掉2 步骤中找到的两个慢查询
kill id;