码迷,mamicode.com
首页 > 数据库 > 详细

查看数据库负载并记录到文件中

时间:2016-05-19 19:04:03      阅读:225      评论:0      收藏:0      [点我收藏+]

标签:

查看数据库负载主要是查询数,连接进程数,正在运行的进程如下:

#!/bin/bash
# screen -D -m -S check_mysql_status sh /path2script/script &
while true; do
sudo mysql --execute=show global status; | awk /Queries/{q=$2} /Threads_connected/{tc=$2} /Threads_running/{printf"%20s %20s %20s\n", q, tc, $2} >> output_log.txt
echo "Sleep 5 seconds"; sleep 5;
done
Queries:
The number of statements excuted by the server

Threads_connected:
The number of currently open connections.

threads_running:
The number of threads that are not sleeping.


查看数据库负载并记录到文件中

标签:

原文地址:http://www.cnblogs.com/wlemory/p/5509538.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!