Advertisement
Guest User

Untitled

a guest
Aug 18th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. DBUSERNAME=username
  4. DBPASSWORD=password
  5. MASTER=master_ip_address
  6. SLAVE=slave_ip_address
  7.  
  8. MASTER_POS=`mysql -h $MASTER -u $DBUSERNAME -p$DBPASSWORD -e 'SHOW MASTER STATUS;'|grep 'bin' | awk '{print $2}'`
  9. SLAVE_POS=`mysql -h $SLAVE -u $DBUSERNAME -p$DBPASSWORD -e 'SHOW SLAVE STATUS\G'|grep 'Exec_Master_Log_Pos' |awk '{print $2}'`
  10. echo "Master Position: $MASTER_POS -> Slave Position: $SLAVE_POS"
  11.  
  12. if [ $MASTER_POS == $SLAVE_POS ]; then
  13.  
  14. echo "Replication is working correctly!"
  15.  
  16. else
  17.  
  18. echo "Replication got problem , please check the replication status"
  19.  
  20. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement