Wison Ho
Wison Ho

Reputation: 83

Configure slave replication for MariaDB Galera

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.

Upvotes: 0

Views: 4148

Answers (3)

Satts
Satts

Reputation: 1

on the async slave node, since we set the master_address to one node of the galera cluster. If the particular node goes down, then the slavereplication will be stopped. how to ensure even if one node goes down, slave replication happens from the other existing master nodes. Kindly advise

Upvotes: 0

Wison Ho
Wison Ho

Reputation: 83

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.

Upvotes: 1

SAGAR BHOOSHAN
SAGAR BHOOSHAN

Reputation: 329

@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.

Upvotes: 0

Related Questions