At the end of the year, do a routine inspection for MySQL.
Preface:
Routine inspection is a required item before the holidays. It performs a round of comprehensive health check on servers. On the one hand, it can ensure the stability of servers during holidays, in addition, you can also check the areas that are not normally covered by monitoring.
Even the powerful O & M team like hearth stone can lose data. What is the reason for you not to perform a inspection?
Inspection is divided into the following four layers:
1. Hardware
2. Operating System
3. Database
4. Architecture
5. ETL
Inspection items:
If you need a large image and remarks, contact me directly. Files in mindmanger format cannot be uploaded on the website. Inspection script:
- #! /Bin/bash
- # This script is used to inspect MySQL.
- # Written by LiHui
- # Version 1.1
- # Data: 2017-01-19
- Echo-e "\ 033 [33 m ======================= hardware check ==== ======================================\033 [0 m"
- Echo-e "\ 033 [31 m ==== display boot information =====\ 033 [0 m"
- Dmesg | tail-20
- Echo-e "\ 033 [31 m ==== view RAID array information =====\ 033 [0 m"
- /Opt/MegaRAID/MegaCli/MegaCli64-LDInfo-Lall-aALL
- Echo-e "\ 033 [31 m ==== check physical disk SMART Information =====\ 033 [0 m"
- /Opt/MegaRAID/MegaCli/MegaCli64-PDList-aALL | egrep 'slot | S. M.A. R. t'
- Echo-e "\ 033 [31 m ==== check RAID Battery status =====\ 033 [0 m"
- /Opt/MegaRAID/MegaCli/MegaCli64-AdpBbuCmd-a0 | grep-E 'charger | isSOHGood | Cycle Count | Max error'
- Echo-e "\ 033 [33 m ====================== operating system check ==== ========================================\033 [0 m"
- Echo-e "\ 033 [31 m ==== startup Item check =====\ 033 [0 m"
- Chkconfig -- list | grep-E "lvs | iptables | zabbix_agentd"
- Echo-e "\ 033 [31 m ==== MySQL startup Item check =====\ 033 [0 m"
- Cat/etc/rc. d/rc. local | grep mysql
- Echo-e "\ 033 [31 m ==== IO Performance Check =====\ 033 [0 m"
- Vmstat 1 5
- Echo-e "\ 033 [31 m ==== memory check =====\ 033 [0 m"
- Free-m
- Echo-e "\ 033 [31 m ==== Operating System Log check =====\ 033 [0 m"
- Tail-50/var/log/messages
- Echo-e "\ 033 [31 m ==== disk space check =====\ 033 [0 m"
- Df-h
- Echo-e "\ 033 [31 m ==== network condition check =====\ 033 [0 m"
- Ifconfig | grep errors
- Echo-e "\ 033 [33 m ===================== database check ==== ======================================\033 [0 m"
- For I in 'netstat-nult | grep 33 | awk-F': ''{print $2} '| awk' {print $1 }''; do echo-e "\ 033 [31 m ==== this section is buffer pool for port" $ I "=====\ 033 [0 m "; mysql-uxxx-pxxx-S/data0/mysqldata/$ I/mysql. sock-e 'show engine innodb status \ G' | grep 'free Buffers'; done
- For I in 'netstat-nult | grep 33 | awk-F': ''{print $2} '| awk' {print $1 }''; do echo-e "\ 033 [31 m ==== this section is error log for port" $ I "=====\ 033 [0 m "; tail-50/data0/mysqldata/$ I/mysql-error.log; done
- Echo-e "\ 033 [33 m ====================== architecture check ==== ======================================\033 [0 m"
- For I in 'netstat-nult | grep 33 | awk-F': ''{print $2} '| awk' {print $1 }''; do echo-e "\ 033 [31 m ==== this section is slave status for port" $ I "=====\ 033 [0 m "; mysql-uxxx-pxxx-S/data0/mysqldata/$ I/mysql. sock-e 'show slave status \ G' | grep-E 'slave _ IO_Running | Slave_ SQL _Running | Master_Log_File | Read_Master_Log_Pos | executor | Exec_Master_Log_Pos | Seconds_Behind_Master '; done
- Echo-e "\ 033 [31 m ==== virtual IP check =====\ 033 [0 m"
- Ip addr | grep lo | grep-v eth1