Script To Check If MySQL Master Master Replication Is Working Correctly
Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Script To Check If MySQL Master Master Replication Is Working CorrectlyThis short article explains how you can use a short script to check whether your MySQL master master replication is working as expected or not. First add a user named "check" with the following mysql queries: CREATE USER 'check'@'localhost' IDENTIFIED BY 'YOURPASSWORD'; GRANT SUPER , REPLICATION CLIENT ON * . * TO 'check'@'localhost' IDENTIFIED BY 'YOURPASSWORD' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0; Then add this bash script to your /root directory. Add it to your crontab if needed : #!/bin/bash PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin ###check if already notified### cd /root if [ -f slave_problem.txt ]; then exit 1; fi ###Check if slave running### ( echo "show slave status \G;" ) | mysql -u check -pYOURPASSWORD 2>&1 | grep "Slave_IO_Running: No" if [ "$?" -ne "1" ]; then echo "Replication failed" > /root/slave_problem.txt fi ###Send notification if replication down### cd /root if [ -f slave_problem.txt ]; then mail -s "Replication problem" admin@example.com < /root/slave_problem.txt fi
|
Sponsored Links:
Unified Communications: Thoughts, Strategies and Predictions
Join the discussion.
www.seamlessenterprise.com
IP Convergence
Integrate your wireless and wireline networks.
Learn how from the experts at Sprint.
www.seamlessenterprise.com
Wireless & Wireline Integration
Thoughts, strategies and solutions: join the discussion
www.seamlessenterprise.com
Unified Communications 2009
Join the Discussion. Now.
www.seamlessenterprise.com
Join the discussion.
www.seamlessenterprise.com
IP Convergence
Integrate your wireless and wireline networks.
Learn how from the experts at Sprint.
www.seamlessenterprise.com
Wireless & Wireline Integration
Thoughts, strategies and solutions: join the discussion
www.seamlessenterprise.com
Unified Communications 2009
Join the Discussion. Now.
www.seamlessenterprise.com







Recent comments
2 hours 10 min ago
3 hours 53 min ago
6 hours 18 min ago
6 hours 24 min ago
10 hours 58 min ago
12 hours 59 min ago
16 hours 23 min ago
18 hours 29 min ago
18 hours 40 min ago
21 hours 6 min ago