Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Promoting a replica to master, or switching the active and passive roles in a master-master replication setup, is an important part of many failover strategies for MySQL. See Chapter 10 for detailed explanations of how to accomplish this manually. As mentioned earlier in this chapter, we aren’t aware of any automated tools that always do the right thing in all situations—or at least, none that we’ll put our reputations behind.
Depending on your workload, you shouldn’t assume that you can fail
over to a passive replica instantly. Replicas replay the master’s
writes, but if you’re not also using them for reads, they will not be
warmed up to serve the production workload. If you want a replica to be
ready for read traffic, you have to continuously “train” it, either by
letting it participate in the production workload or by mirroring
production read queries onto it. We’ve sometimes done this by sniffing
TCP traffic, filtering out everything but SELECT queries, and replaying those against
the replica. Percona Toolkit has tools that can help with this.