Databases Reference
In-Depth Information
Emulating multisource replication
MySQL does not currently support multisource replication (i.e., a replica with more
than one master). However, you can emulate this topology by changing a replica to
point at different masters in turn. For example, you can point the replica at master A
and let it run for a while, then point it at master B for a while, and then switch it back
to master A again. How well this will work depends on your data and how much work
the two masters will cause the single replica to do. If your masters are relatively lightly
loaded and their updates won't conflict at all, it might work very well.
You'll need to do a little work to keep track of the binary log coordinates for each
master. You also might want to ensure that the replica's I/O thread doesn't fetch more
data than you intend it to execute on each cycle; otherwise, you could increase the
network traffic and load on the master significantly by fetching and throwing away a
lot of data on each cycle.
You can also emulate multisource replication using master-master (or ring) replication
and the Blackhole storage engine with a replica, as depicted in Figure 10-13 .
Figure 10-13. Emulating multisource replication with dual masters and the Blackhole storage engine
In this configuration, the two masters each contain their own data. They each also
contain the tables from the other master, but use the Blackhole storage engine to avoid
actually storing the data in those tables. A replica is attached to one of the co-masters—
it doesn't matter which one. This replica does not use the Blackhole storage engine at
all, so it is effectively a replica of both masters.
In fact, it's not really necessary to use a master-master topology to achieve this. You
can simply replicate from server1 to server2 to the replica. If server2 uses the Blackhole
storage engine for tables replicated from server1 , it will not contain any data from
server1 , as shown in Figure 10-14 .
 
Search WWH ::




Custom Search