Mysql – How to actually use thesql slave as soon the master is failover or got burnt

disaster-recoveryMySQLreplication

I have MySQL master-slave replication that works fine; I googled the whole net and MySQL site to find the standard procedure to make use of the replication but found nothing. It is as if admins are happy to have replication on, but when the time comes to perform a disaster recovery no initial plan has been put into practice and publicly shared.

What i want to know is how to make the slave machine replace the master one in case the later got damaged, burnt, etc. I guess the slave machine should take the network address of the master but what else should be done? For instance, changing MySQL user permissions or running some commands! Please include references if any.

Best Answer

For a DR solution you most likely want a semi-manual process. That is, you need to decide the disaster validates a full DR failover and it's not just a small network blipp and you're stuck with days of fail-back work.

To switch a MySQL slave to a master you just issue a few commands in mysql, Mysql details can be found here.

I'd strongly suggest scripting the whole process (and test it!) and add whatever other commands you may want to run on the box to do the DR failover (restart the web tier or whatever else is needed). We use func on a management server to run failover commands all the tiers of our applications.

When referring to disaster recovery I'm talking about site failure. For a cluster failover things should probably be automatic and much simpler.

Related Topic