Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- DBUSERNAME=username
- DBPASSWORD=password
- MASTER=master_ip_address
- SLAVE=slave_ip_address
- MASTER_POS=`mysql -h $MASTER -u $DBUSERNAME -p$DBPASSWORD -e 'SHOW MASTER STATUS;'|grep 'bin' | awk '{print $2}'`
- SLAVE_POS=`mysql -h $SLAVE -u $DBUSERNAME -p$DBPASSWORD -e 'SHOW SLAVE STATUS\G'|grep 'Exec_Master_Log_Pos' |awk '{print $2}'`
- echo "Master Position: $MASTER_POS -> Slave Position: $SLAVE_POS"
- if [ $MASTER_POS == $SLAVE_POS ]; then
- echo "Replication is working correctly!"
- else
- echo "Replication got problem , please check the replication status"
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement