Reputation: 21
I have two servers (A & B), with MySQL Enterprise Edition 5.7.21, and RHEL 7.4 version. I want to replicate one table from Server A with a table with different name to Server B. In same time i want another table from Server B to replicate to an another table to Server A, like two master-slave:
masterA -> SlaveB
masterB -> SlaveA
I know how create replication. My Question is if i can replicate one table to another table name. For Example:
ServerA: User: myschema tables: t1, t2
ServerB: User: myschema tables: t3, t4
I want to replicate: myschema.t1 => myschema.t3 (master Server A, Slave Server B) and myschema.t4 => myschema.t2 (master Server B, Slave Server A)
Is that possible?
I want the result to be the same data in a combination of tables:
--serverA: select * from t1 union select * from t2
is equal to
--ServerB: select * from t3 union select * from t4.
Info about my.cnf in both servers, for only one replicate.
ServerA: master
ServerB: slave
Upvotes: 1
Views: 245
Reputation: 1986
No it's not possible, you always replicate between tables with the same name because you are replaying the log from one server on it's slave.
Since you seem to be writing to both servers and into different tables, why don't you just have tables t1 and t2 on both and have your application write t1 data to one server and t2 data to the other server and replicate master-master?
Upvotes: 1