In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces "automatic monitoring master-slave MySQL synchronization SHELL script sharing". In daily operation, I believe many people have doubts about automatic monitoring master-slave MySQL synchronization SHELL script sharing. The editor consulted all kinds of information and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "automatic monitoring master-slave MySQL synchronization SHELL script sharing". Next, please follow the editor to study!
The code is as follows:
Double-click the code to select 12 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 crontab time 00:10 MYSQLPORT= `netstat-na | grep "LISTEN" | grep "3306" | awk-F [: "] +'{print $4} '`MYSQLIP= `ifconfig eth0 | grep" inet addr | awk-F [: "] +' {print $4} '`STATUS=$ (/ usr/local/webserver/mysql/bin/mysql-u yuhongchun-pyuhongchun101 -) S / tmp/mysql.sock-e "show slave statusG" | grep-I "running") IO_env= `echo $STATUS | grep IO | awk'{print $2} '`SQL_env= `echo $STATUS | grep SQL | awk' {print $2} '`DATA= `date + "% y-%m-%d% H:%M:%S" `if ["$MYSQLPORT" = "3306"] then echo "mysql is running" else mail-s "warnkeeper server: $MYSQLIP mysql is down" yuhongchun027@163.com fi if ["$IO" _ env "=" Yes "- a" $SQL_env "=" Yes "] then echo" Slave is running! "" else echo "# $DATA #" > / data/data/check_mysql_slave.log echo "Slave is not running!" > / data/data/check_mysql_slave.log echo "Slave is not running!" | mail-s "warn! $MYSQLIP MySQL Slave is not running" yuhongchun027@163.com fi
It is recommended to run it every ten minutes.
* / 10 * root/ bin/sh / root/mysql_slave.sh
Remember to assign a yuhongchun user to each MySQL slave machine. It doesn't matter if you have more privileges. It can only be run locally, as shown below:
Double-click the code to select all 1 2grant all privileges on *. * to "yuhongchun" @ "127.0.0.1" identified by "yuhongchun101"; grant all privileges on *. * to "yuhongchun" @ "localhost" identified by "yuhongchun101"; at this point, the study on "automatic monitoring master-slave MySQL synchronization SHELL script sharing" is over, hoping to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.