About MySQL master and slave is normal judgment

Source: Internet
Author: User
Develop a daemon script that monitors MySQL master-slave replication anomalies (including unsynchronized and delayed) every 30 seconds

#!/bin/bashfile=/root/mysql.txt #mysql > Show slave status\g; This command can view status information and save it to a file. Aa= ($ (Cat $file | grep-e ' Running| Behind ' | Cut-d ': '-f2)) for ((i=0;i<${#aa [*]};i++)) do count=0 if [${aa[i]}! = "Yes"-a ${aa[i]}! = "0"]; Then echo ' bad ' let count+=1 else echo ' good ' fidone

For a delay of 30 seconds, put the above script inside the function, using the while true null value, plus sleep 30


About MySQL master and slave is normal judgment

Related Article

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.