I have setup a Master-Master-Slave replication where say A B and C, I want to replicate data from A to B (which is working) and B to C (also working) and from A to C which is not working with two masters since one slave is configured to accept only one master.My query is how to configure slave to accept multiple masters.

I want to achieve the following structure :

Tables in Master 1
| Master1-DB   | 
| Table1       |
| Table2       |
| Table5       |
Tables in Master 2 where table 2 is replicated form master 1
| Master2-DB                | 
| Table1 From Master1       |
| Table3                    |
| Table4                    |
Tables in master 3 where table 1 is from Master 1 and table 2 is from Master 2 must be replicated.
| Slave-DB                 | 
| Table1 From Master1      |
| Table3 From Master2      |
| Table4 From Master2      |
| Table5 From Master1      |

You can't configure a MySQL server to connect to multiple masters as a replication slave.

You can configure Master B with log_slave_updates enabled, Master A with binlog_format = ROW and declare table 2 using Engine=BLACKHOLE on Master B, and the replication events from Master A's binary log will cascade through Master B onto Slave C, which would be connected only to Master B (not directly to A).

Otherwise, your alternative is Multi-Source Replication in MariaDB, which (unlike Oracle MySQL) does allow a single server to connect to multiple upstream masters simultaneously, as long as there are no conflicting combinations of schema+table names being replicated. This configuration should work whether the master servers are actually running MariaDB or if they're running MySQL.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.