Galera cluster asynchronous replication








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.

Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to set up database replication.

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.
binlog_format=ROW
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.


[Still, having trouble in replicating your Galera cluster? – We can help you. ]



Conclusion

This article will guide you on steps to perform Galera cluster asynchronous replication for #MySQL.  Galera Cluster for MySQL is a true Multi-Master Cluster based on synchronous replication. It's an easy-to-use, high-availability solution, which provides high system up-time, no data loss and scalability for future growth.

To do you get a Galera Cluster:

1. Create a #Cloud Server. First, log in to your Cloud Server via an SSH tool such as putty.

2. Install #MariaDB Server on All Servers.

3. Configure Each Server in the #Cluster.

4. Initialize the Galera Cluster.

5. Test Galera Cluster #Replication.


For Linux Tutorials

We create Linux HowTos and Tutorials for Sys Admins. Visit us on LinuxAPT.com

Also for Tech related tips, Visit forum.outsourcepath.com or General Technical tips on www.outsourcepath.com