We have a Rails application sitting on top of MySQL. We have MySQL
Master Slave replication running. The Master server running MySQL is
called DB01 and the Slave server running MySQL is called APP02.
I’m trying to figure out the best way to fail over to the Slave DB
running on APP02 in the event that MySQL becomes unavailable on DB01.
Does anyone have any ideas on the best way to do this? I was thinking of
setting up a crontab job to perform a simple MySQL query every 30
seconds, and if it returns an error or timeout, it would restart the
mongrel cluster using the APP02 database connection.
Any advice is much appreciated.