首页 > 数据库技术 > 详细

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

时间:2016-05-19 19:02:21      阅读:279      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!