Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
mysql:replication [2008/09/03 18:57] a |
mysql:replication [2009/05/25 00:35] (current) |
||
---|---|---|---|
Line 66: | Line 66: | ||
mysql -u user -ppassword | mysql -u user -ppassword | ||
| | ||
+ | |||
===== Master Master | ===== Master Master | ||
- | see [[http:// | + | see **[[http:// |
+ | |||
+ | |||
+ | ==== Script To Check If MySQL Master Master Replication Is Working Correctly ==== | ||
+ | |||
+ | This 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 " | ||
+ | |||
+ | | ||
+ | |||
+ | GRANT SUPER , REPLICATION CLIENT ON * . * TO ' | ||
+ | |||
+ | Then add this bash script to your /root directory. Add it to your crontab if needed : | ||
+ | |||
+ | <code bash|check-master-master.sh> | ||
+ | # | ||
+ | PATH=/ | ||
+ | |||
+ | ###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 " | ||
+ | if [ " | ||
+ | echo " | ||
+ | fi | ||
+ | ###Send notification if replication down### | ||
+ | cd /root | ||
+ | if [ -f slave_problem.txt ]; then | ||
+ | mail -s " | ||
+ | fi | ||
+ | </ | ||