Advertisement
Guest User

Untitled

a guest
May 31st, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. #!/usr/bin/env ruby
  2. require 'mysql2'
  3.  
  4. while 1
  5. client = Mysql2::Client.new(
  6. host: "",
  7. username: "",
  8. password: "")
  9.  
  10. slave_status = client.query("show slave status;")
  11.  
  12. if slave_status.first["Last_SQL_Errno"] == 1045
  13. client.query("CALL mysql.rds_skip_repl_error;")
  14. elsif slave_status.first["Slave_IO_Running"] == "No"
  15. client.query("CALL mysql.rds_start_replication;")
  16. end
  17. sleep 0.5
  18. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement