At the end of the year, do a routine inspection for MySQL.

Source: Internet
Author: User

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:

  1. #! /Bin/bash
  2. # This script is used to inspect MySQL.
  3. # Written by LiHui
  4. # Version 1.1
  5. # Data: 2017-01-19

  6. Echo-e "\ 033 [33 m ======================= hardware check ==== ======================================\033 [0 m"

  7. Echo-e "\ 033 [31 m ==== display boot information =====\ 033 [0 m"
  8. Dmesg | tail-20

  9. Echo-e "\ 033 [31 m ==== view RAID array information =====\ 033 [0 m"
  10. /Opt/MegaRAID/MegaCli/MegaCli64-LDInfo-Lall-aALL

  11. Echo-e "\ 033 [31 m ==== check physical disk SMART Information =====\ 033 [0 m"
  12. /Opt/MegaRAID/MegaCli/MegaCli64-PDList-aALL | egrep 'slot | S. M.A. R. t'

  13. Echo-e "\ 033 [31 m ==== check RAID Battery status =====\ 033 [0 m"
  14. /Opt/MegaRAID/MegaCli/MegaCli64-AdpBbuCmd-a0 | grep-E 'charger | isSOHGood | Cycle Count | Max error'



  15. Echo-e "\ 033 [33 m ====================== operating system check ==== ========================================\033 [0 m"

  16. Echo-e "\ 033 [31 m ==== startup Item check =====\ 033 [0 m"
  17. Chkconfig -- list | grep-E "lvs | iptables | zabbix_agentd"

  18. Echo-e "\ 033 [31 m ==== MySQL startup Item check =====\ 033 [0 m"
  19. Cat/etc/rc. d/rc. local | grep mysql

  20. Echo-e "\ 033 [31 m ==== IO Performance Check =====\ 033 [0 m"
  21. Vmstat 1 5

  22. Echo-e "\ 033 [31 m ==== memory check =====\ 033 [0 m"
  23. Free-m

  24. Echo-e "\ 033 [31 m ==== Operating System Log check =====\ 033 [0 m"
  25. Tail-50/var/log/messages

  26. Echo-e "\ 033 [31 m ==== disk space check =====\ 033 [0 m"
  27. Df-h

  28. Echo-e "\ 033 [31 m ==== network condition check =====\ 033 [0 m"
  29. Ifconfig | grep errors



  30. Echo-e "\ 033 [33 m ===================== database check ==== ======================================\033 [0 m"

  31. 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

  32. 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



  1. Echo-e "\ 033 [33 m ====================== architecture check ==== ======================================\033 [0 m"

  2. 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

  3. Echo-e "\ 033 [31 m ==== virtual IP check =====\ 033 [0 m"
  4. Ip addr | grep lo | grep-v eth1



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.