Multiple masters
It is safe to connect servers in a circular master/slave
relationship if you use the --log-slave-updates
option. That means that you can create a setup as shown in
図 5.5. 「Replication with multiple masters in a chain topology」.
However, many statements do not work correctly in this kind of setup unless your client code is written to take care of the potential problems that can occur from updates that occur in different sequence on different servers.
Server IDs are encoded in binary log events, so server A knows
when an event that it reads was originally created by itself and
does not execute the event (unless server A was started with the
--replicate-same-server-id
option, which is
meaningful only in rare cases). Thus, there are no infinite loops.
This type of circular setup works only if you perform no
conflicting updates between the tables. In other words, if you
insert data in both A and C, you should never insert a row in A
that may have a key that conflicts with a row inserted in C. You
should also not update the same rows on two servers if the order
in which the updates are applied is significant.