大橙子网站建设,新征程启航

为企业提供网站建设、域名注册、服务器等服务

观察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://dzwzjz.com/article/phdido.html
在线咨询
服务热线
服务热线:028-86922220
TOP