Home >Database >Mysql Tutorial >详解MySQL中SlowLog的实际配置_MySQL

详解MySQL中SlowLog的实际配置_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-01 14:02:07981browse

MySQL日志系统上线有段时间了,前端在慢慢切站点过来写入,未雨绸缪配置了一套MySQL监控工具.

分为 slave  status ,sync,objec infot,userprivileges,job status ,slowlog.

这次说下slow_log

MySQL 1.5 开始支持 set global 全局来更改变量设置。而无需重启服务.

可以用

show variables 来查看变量设置

开启log_output table 选项 5.1 以上版本支持 table 和 file 2个选项 同时用 ,分开 如:set global log_output='Table,File';

开启 log_slow_query

set global log_slow_query = on;

用 show variables like 'long%' 查看 long_query_time 值 默认为10 秒

这样 MySQL自动会把 slowlog 超过10秒的 查询语句存放到 mysql库 slow_log表中。

配合 ssis 和 proc 每天监控 多台服务器。也适用于大规模的MySQL,下次写监控的点和面的问题。

ssis 教程见 和这个类似

http://www.cnblogs.com/xwj1985/archive/2010/10/30/1865292.html

ssis 流程图:

mail 效果图: 这个是测试用slowlog long_query_time 时间设置为 0

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn