I've been working the last few weekends on setting up redundancy and failover for a MySQL server at work. In the process, I've run across various bits of useful information in different places, but nowhere have I seen it all brought together. So, I'm going to attempt to do that here.
The basic idea was to set up a dual-master replication setup with CARP failover. (I've heard of similar setups with Linux-HA heartbeat failover, but we're using FreeBSD, so CARP was a natural fit for us.)
A couple of notes in the examples below:
- Our servers have two network ports, so we have the replication on a separate interface from all of the "real" traffic. This isn't strictly necessary, but since we have the capacity available, we might as well use it.
- The IP addresses for replication in my examples will be 10.0.0.10 for the original server, and 10.0.0.11 for the new failover server.
- The IP addresses for …