xxxx-xx-xx系统应用(周)巡检报告模版
xxxx-xx-xx系统应用(周)巡检报告模版
1、巡检概述与总结
系统名称 | 巡检时间 | ||
---|---|---|---|
巡检人 | 联系方式 | ||
巡检单位 | |||
巡检结论 |
2、巡检项目
(一)系统容量巡检
1.1 CPU使用率 低
1.2 内存使用率 正常
1.3 文件系统使用率 /cmcc 使用率高
(二)应用检查
2.1 服务巡检
2.2 应用日志(报错、告警等) 未见异常
tail -f catalina.out
(三) 数据库巡检 mysql
3.1 数据库命中率
key_reads / key_read_requests应该尽可能的低,至少是1:100,1:1000更好
show status like 'key_read%';
show global status like 'open%tables%';
Opened_tables数值非常大,说明cache太小,导致要频繁地open table,可以查看下当前的table_open_cache设置:
show variables like '%table_open_cache%';
table_open_cache 默认是64 已调大到2048
3.2 数据盘空间利用率
SELECT
TABLE_SCHEMA,
CONCAT(
TRUNCATE(SUM(data_length) / 1024 / 1024, 2),
' MB'
) AS data_size,
CONCAT(
TRUNCATE(SUM(index_length) / 1024 / 1024, 2),
'MB'
) AS index_size
FROM
information_schema.tables
GROUP BY TABLE_SCHEMA;
3.3 数据库死锁及进程状态
show status like 'innodb_row_lock_%';
解释如下:
Innodb_row_lock_current_waits : 当前等待锁的数量
Innodb_row_lock_time : 系统启动到现在,锁定的总时间长度
Innodb_row_lock_time_avg : 每次平均锁定的时间
Innodb_row_lock_time_max : 最长一次锁定时间
Innodb_row_lock_waits : 系统启动到现在总共锁定的次数
mysql> desc information_schema.innodb_locks;
+-------------+---------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------+---------------------+------+-----+---------+-------+
| lock_id | varchar(81) | NO | | | |#锁ID
| lock_trx_id | varchar(18) | NO | | | |#拥有锁的事务ID
| lock_mode | varchar(32) | NO | | | |#锁模式
| lock_type | varchar(32) | NO | | | |#锁类型
| lock_table | varchar(1024) | NO | | | |#被锁的表
| lock_index | varchar(1024) | YES | | NULL | |#被锁的索引
| lock_space | bigint(21) unsigned | YES | | NULL | |#被锁的表空间号
| lock_page | bigint(21) unsigned | YES | | NULL | |#被锁的页号
| lock_rec | bigint(21) unsigned | YES | | NULL | |#被锁的记录号
| lock_data | varchar(8192) | YES | | NULL | |#被锁的数据
+-------------+---------------------+------+-----+---------+-------+
10 rows in set (0.09 sec)
3.3 缓存使用率
show global status like 'innodb%read%';
3.4 查询无主键的表
SELECT
table_schema,
table_name
FROM
information_schema.TABLES
WHERE
table_name NOT IN ( SELECT DISTINCT table_name FROM information_schema.COLUMNS WHERE column_key = "PRI" )
AND table_schema IN ( 'caoss' );
3.4表碎片检查
select TABLE_SCHEMA,TABLE_NAME,ENGINE,concat(splinter,'G') '碎片(G)' from (
SELECT TABLE_SCHEMA,TABLE_NAME,ENGINE,ROUND((DATA_LENGTH+INDEX_LENGTH-TABLE_ROWS*AVG_ROW_LENGTH)/1024/1024/1024) splinter from information_schema.`TABLES` where TABLE_TYPE='BASE TABLE'
)a WHERE splinter >1 ORDER BY splinter DESC;
3.5 慢sql查询
show variables like 'slow_query_log';
SELECT * FROM `slow_log` where start_time > '2019/05/19 00:00:00';