Hi All
Good Afternoon
I have two Percona XtraDB MySQL clusters:
Cluster A:
- Master: 172.10.10.05
- Node: 172.10.10.06
Cluster B:
- Master: 172.10.10.07
- Node: 172.10.10.08
I am trying to set up bidirectional replication between these two clusters. The configurations I used are as follows:
1. Create Replication Users
On Cluster A:
CREATE USER 'replicator'@'%' IDENTIFIED BY 'password';
GRANT REPLICATION SLAVE ON *.* TO 'replicator'@'%';
FLUSH PRIVILEGES;
On Cluster B:
CREATE USER 'replicator'@'%' IDENTIFIED BY 'password';
GRANT REPLICATION SLAVE ON *.* TO 'replicator'@'%';
FLUSH PRIVILEGES;
2. Configure Cluster A to Replicate to Cluster B
On a node in Cluster A, add the following configuration to the my.cnf
or my.cnf.d
file:
[mysqld]
server-id=1
log-bin=mysql-bin
binlog-format=ROW
gtid-mode=ON
enforce-gtid-consistency=ON
log-slave-updates=ON
Restart MySQL on all nodes in Cluster A:
systemctl restart mysql
3. Configure Cluster B to Replicate to Cluster A
On a node in Cluster B, add the following configuration to the my.cnf
or my.cnf.d
file:
[mysqld]
server-id=2
log-bin=mysql-bin
binlog-format=ROW
gtid-mode=ON
enforce-gtid-consistency=ON
log-slave-updates=ON
Restart MySQL on all nodes in Cluster B:
systemctl restart mysql
4. Set Up Replication
On Cluster A, find the current binary log file and position:
SHOW MASTER STATUS;
On Cluster B, execute the following command, replacing MASTER_LOG_FILE
and MASTER_LOG_POS
with the values obtained from Cluster A:
CHANGE MASTER TO
MASTER_HOST='172.10.10.07',
MASTER_USER='replicator',
MASTER_PASSWORD='password',
MASTER_AUTO_POSITION=1;
START SLAVE;
On Cluster B, find the current binary log file and position:
SHOW MASTER STATUS;
On Cluster A, execute the following command, replacing MASTER_LOG_FILE
and MASTER_LOG_POS
with the values obtained from Cluster B:
CHANGE MASTER TO
MASTER_HOST='172.10.10.05',
MASTER_USER='replicator',
MASTER_PASSWORD='password',
MASTER_LOG_FILE='mysql-bin.000001',
MASTER_LOG_POS=157,
MASTER_AUTO_POSITION=1;
START SLAVE;
5. Verify Replication
On Cluster A:
SHOW SLAVE STATUS\G;
On Cluster B:
SHOW SLAVE STATUS\G;
However, when I start the slave, the cluster nodes are not communicating properly; they only synchronize between the masters, but the master nodes are not syncing with each other.
i want to sync cluster A to Cluster B and cluster B to Cluster A is it possible