一 处理MySQL慢查询日志和错误日志
MySQL的慢查询日志有两种记录方式,文件和表。
MySQL的慢查询日志如下:
/usr/local/mysql/bin/mysqld, Version: 5.5.21-log (Source distribution). started with:
Tcp port: 3306 Unix socket: /var/lib/mysql/mysql.sock
Time Id Command Argument
# Time: 150422 12:08:32
# User@Host: root[root] @ localhost []
# Query_time: 0.000496 Lock_time: 0.000329 Rows_sent: 1 Rows_examined: 1
use zabbix;
SET timestamp=1429675712;
SELECT dv.mandatory,dv.optional FROM dbversion dv;
# User@Host: root[root] @ localhost []
# Query_time: 0.001546 Lock_time: 0.000320 Rows_sent: 0 Rows_examined: 0
SET timestamp=1429675712;
SELECT n.* FROM nodes n WHERE n.nodetype=1 ORDER BY n.nodeid;
# User@Host: root[root] @ localhost []
# Query_time: 0.000486 Lock_time: 0.000364 Rows_sent: 1 Rows_examined: 1
SET timestamp=1429675712;
select t.globalmacroid,t.macro,t.value from globalmacro t order by t.globalmacroid;
# User@Host: root[root] @ localhost []
# Query_time: 0.000887 Lock_time: 0.000349 Rows_sent: 16 Rows_examined: 130
SET timestamp=1429675712;
select t.interfaceid,t.hostid,t.main,t.type,t.useip,t.ip,t.dns,