Are you trying to perform Galera cluster asynchronous replication?
Here is a guide.
Galera Cluster is a synchronous multi-master replication plug-in for InnoDB.
An application can write to any node in a Galera cluster, and transaction commits (row-based replication events) are then applied on all servers, via a certification-based replication.
Generally, Galera can be used in database replication for frequently copying data from one node to another node.
We do database replication to provide high scalability and availability of the database.
In this context, we shall look into how to set up Galera cluster asynchronous replication.
Galera cluster asynchronous replication for MySQL
Here, you shall learn how to do MySQL replication with the Galera cluster.
Initially, we will deploy the clusters as required.
Here let's take the instance where we use 6 nodes.
That is 3 for primary and 3 for the disaster recovery site.
Then we take one node and setup an asynchronous replication link.
The parameters inside my.cnf will be seen as given below:
server_id=40 # this number must be different on every node.
log_bin = /var/lib/mysql-binlog/binlog
log_slave_updates = ON
gtid_mode = ON
enforce_gtid_consistency = true
expire_logs_days = 7
Then we will create a replication user and point the slave to master to replicate the slave.
We can do this using the following commands:
mysql> GRANT REPLICATION SLAVE ON *.* to slave@'%' IDENTIFIED BY 'slavepassword';
mysql> CHANGE MASTER TO MASTER_HOST = 'galera3-primary', MASTER_USER = 'slave', MASTER_PASSWORD = 'slavepassword' , MASTER_AUTO_POSITION=1;
mysql> START SLAVE;
Next, we need to set up alternative master nodes in one cluster in case of failure. That is, if the master node in cluster 1 fails then another node in the same cluster must be available for the client.
In addition, we will also consider the situation where the cluster itself fails.
In this case, if the primary cluster is not available for the client then the second one will be available.