Search code examples
mysqlreplicationmaster-slavegaleragtid

Set up GTID replication between Galera Cluster and standalone MySQL slave


Anybody has experience with setting up replication between Galera Cluster and standalone MySQL slave?

I have a three nodes in Galera Cluster and I want to set up gtid replication to MySQL slave. The problem that is all Galera nodes write their own bin logs and seems it causing duplication queries. As result, I get infinite errors like this:

Cannot add or update a child row: a foreign key constraint fails ..., Error_code: 1452; handler error HA_ERR_NO_REFERENCED_ROW; the event's master log mysql-bin.000003, end_log_pos 76110900

replication settings on Galera nodes:

[mysqld]
log_slave_updates=1
log_bin=mysql-bin
gtid_mode=ON
enforce_gtid_consistency=1
expire_logs_days=7
server_id = 3 # 1 for node1, 2 for node2, 3 for node3
binlog_format=ROW

Maybe do you know how is possible to resolve it ?


For setting I used this topic: http://severalnines.com/blog/how-set-asynchronous-replication-galera-cluster-standalone-mysql-server-gtid

Galera nodes version: 5.6.25

MySQL slave version: 5.6.27


Solution

  • I set the same server_id values for all nodes in Galera clustes and now all works properly.