0
votes

MariaDB 10.2.10+Centos 7.

I have configured the MariaDB Galera Cluster with HAProxy, and tested successfully.

For backup, I wanted to add one async replication slave for the Galera cluster, but failed.

Below is my action:

After all galera cluster actions were done, I added below configuration under each galera node's /etc/my.cnf.d/server.cnf's [mysqld] section:

[mysqld]
log_bin
log_slave_updates
gtid_strict_mode
server_id=1
 [galera]
wsrep_gtid_mode

and added below configuration under each slave node's /etc/my.cnf.d/server.cnf's [mysqld] section:

[mysqld]
binlog_format=ROW
log_bin
log_slave_updates
server_id=2
gtid_strict_mode

Later created one user for replication, and did mysqldump out on one galera node and did an import on slave node.

Then ran on slave:

stop slave; change master to master_host='one galera node name ',master_port=3306,master_user='repl_user',master_password='repl_password',master_use_gtid=current_pos; start slave;

but failed. The error msg is:

Got fatal error 1236 from master when reading data from binary log: 'Error: connecting slave requested to start from GTID 0-2-11, which is not in the master's binlog'

Do you have any suggestion, if any, very appreciated.

2
I suspect only one node should be told about the one async Slave. - Rick James
yes. on the async slave node, i set the master_address to one node of the galera cluster. - Wison Ho

2 Answers

1
votes

After researching, I modified the settings I mentioned above:

on each node of the Galera Cluster, they have the same domain id and different server id:

[mysqld]
log_bin
log_slave_updates
gtid_strict_mode
gtid_domain_id=1
server_id=1
 [galera]
wsrep_gtid_mode

on the slave node, slave node has the different domain id and server id:

[mysqld]
binlog_format=ROW
log_bin
log_slave_updates
gtid_domain_id=2
server_id=2

then do mysqldump out and mysql import, last run

change master to master_host='one galera node name',master_port=3306, master_user='repl_user',master_password='aa',master_use_gtid=current_pos;
start slave;

Everything goes well.

When I add database or table or insert data into one table, it can sync to the slave node.

0
votes

@Winson He

the explanation is wrong. Its should be as follows : galera node 1, 2, 3 => Same domain_ID and Unique server_id for each node.

Slave Node => Different domain_ID and unique server_id.

So in fact, no matter Cluster/Master/Slave all servers have a unique server_id and Galera cluster nodes will have same domain_id and slaves lie in different domain_id.