观察MySQL进程状态-成都快上网建站

观察MySQL进程状态

1、测试脚本
[root@MySQL5 ~]# cat proce.sh 
while true
do
mysql -uroot -pmysql -e 'show processlist \G'|grep State >> /root/mysql.log
sleep 1
done

2、tail -f 
[root@mysql5 ~]# tail -f mysql.log 
  State: 
  State: starting
  State: 
  State: starting
  State: 
  State: starting
  State: 
  State: starting
  State: 
  State: starting
  State: 
  State: starting
  State: 
  State: starting
  State: 
  State: starting
  State: 
  State: starting

3、对mysql.log按行进行排序、去重、计数
[root@mysql5 ~]# sort mysql.log |uniq -c
     24   State: 
     24   State: starting

4、根据state的信息,对数据库进行分析

当前题目:观察MySQL进程状态
文章地址:http://kswjz.com/article/phdido.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流