Toggle navigation
主页
English
K8S
Golang
Guitar
About Me
归档
标签
Welcome to Sanger's Blog!
服务器及MySQL数据库巡检手册
无
2022-03-31 12:24:38
26
0
0
sanger
[TOC] # 服务器及MySQL数据库巡检手册 ## 服务器巡检 Linux服务器是系统重要的业务运行平台,对服务器进行巡检能够及时发现服务 器的隐患,以便于改善和优化服务器的性能;观察服务器的运行状况,及时对 设备进行调整,保证服务器的24小时不间断的工作。 ## 硬件配置信息 检查项 | 检查操作 -|-| 机器型号 |dmidecode 1 grep "Product Name" | CPU | cat /proc/cpuinfo \| grep name \| cut -f2 -d: \| uniq -c 内存| free -m 磁盘| df -h 网卡| ifconfig -a 操作系统| uname -a ## 性能检查 检查项 | 检查操作 |参考指标 -|-|-| CPU占用率| top| CPU每个线程占用率小于80% CPU负载| uptime| CPU负载应小于10 内存占用率| free -m| 内存使用率小于80% 内存swap使用率| free -m| swap使用率小于10% 磁盘使用率| df -ah| 磁盘使用率小于80% 磁盘负载| iostat -xkd 1| uti 1应在10%以内 系统开放端口| netstat -an Igrep LISTEN| 只显示出提供对于服务的端 口,无关的端口一律关闭 网卡流量| iftop| 网卡流量小于带宽的50% 进程检查| ps aux \| more| 关闭占用资源的无用进程 ## 数据库日常健康巡检表 检查项| 检查操作| 参考指标 -|-|-| 进程检查| ps -ef \| grep mysqld| 检查port以及datadir 数据库版本| select version()| 超大库检查| du -sh| 每个数据库目录 超大表检查| show table status| 检查输出后的Rows、Data_length 指标,Rows应小于10000000行 错误日志| show variables like '%log_error%';| 查看文件中是否有ERROR的日志 慢查询日志| show variables like '%slow%';| 检查慢日志是否开启,若开启,检 查慢日志文件中的语句 重要参数检查| backlog max_allowed_packet interactive_timeout<br> wait_timeout skip_name_resolve max_connections<br> log_bin expire_logs_days open_file_limit<br> table_open_cache thread_cache_size<br> sort_buffer_size join_buffer_size<br> innodb_buffer_pool_size innodb_file_per_table<br> innodb_open_files innodb_thread_concurrency<br> innodb_flush_log_at_commit innodb_log_buffer_size<br> innodb_log_file_size innodb_log_files_in_group<br> general_log log_error slow_query_log<br> long_query_time | 根据机器配置以及应用需求检查每 个参数是否配置合理。 QPS检查| 间隔执行 show status like 'queries'| 通过两次的间隔时间做差值,计算 QPS 读写比检查| show status like 'com_%' | 读请求是com_select; 写请求是com_insert; com_update;com_delete 通过统计读写的请求数,算出读写 由列。 当前连接数检查| show status like '%Threads_connected%' | 此数据显示当前的连接数,应远小 于 max_connections。 最大连接数检查| show status like '%max_used_connections%'; show variables like '%max connections%';| 若 max_used_connectio ns 逼近 max_connections,则需要调大 max_connections 异常连接检查| show variables like '%Aborted%' |检查 Aborted_clients 以及 Aborted_connect s 值是否正常 并发线程查询| show global status like '%threads_running%';| 此值应小于10,如果过大,说明并 发数太多,存在慢语句。 线程缓存池检查| show status like '%threads_created%';<br> show status like 'connections'; |threads_created/connections 为缓 存未命帀率,若此值过高,则需要 调大 thread_cache_size。 运行线程状态查询| show full processlist;| 查看当前并发线程是否状态正常 InnoDB Buffer Pool 检查| show status like 'Innodb_buffer_pool_read_reques ts';<br> show status like 'lnnodb_buffer_pool_reads';| Innodb_buffer_pool_reads/ Innodb_buffer_pool_read_request s为缓存未命帀率,若此宿过高, 则需要调大 innodb_buffer_pool_size。 锁等待检查| show full processlist;| 检查state列是否存在wait for xxx lock的状态,如果有则存在锁等待 InnoDB死锁检查| show engine innodb status;| 查看 L ATEST DETECTED DEADLOCK输出段,如果存在, 需要摘取相应的语句。 InnoDB长事务检查| show engine innodb status;| 检查TRANSACTIONS输出段,看 是否存在ACTIVE时间过长的事 务,如果存在,则需要关注。 表缓存检查| show global status like'%opened_tables%';<br> show variables like '%table_open_cache%';| 若opened_table s过大,则需要调 大table_open_cache 值。 查询缓存检查| show variables like '%query_cache%'| 一般情况下,需要禁用query cacheo 临时表检查| show global status like '%tmp%';| 如果 Created_tmp_tables, Created_tmp_disk_table s 或者 Created_tmp_files食高,则需要排 查慢查面(子查询以、排序、 Group By 等) binlog是否开启| show variables like'log-bin'| 复制检查| show slave status;| 查看线程是否正常,延迟是否存在| 备份检查| 检查备份脚本是否正确,检查备份 文件是否可用 |
上一篇:
swap增加与关闭
下一篇:
Jenkins clusters running with java
0
赞
26 人读过
新浪微博
微信
更多分享
腾讯微博
QQ空间
人人网
文档导航