MySQL Group ReplicationMySQL Group Replication is a plugin that helps to implement highly available fault-tolerant replication topologies. In this blog, I am going to explain the complete steps involved in the below two topics.

  • How to convert the group replication member to an asynchronous replica
  • How to convert the asynchronous replica to a group replication member

Why Am I Converting From GR Back to Old Async?

Recently I had a requirement from one of our customers running 5 node GR clusters. Once a month they are doing the bulk read job for generating the business reports. When they are doing the job, it affects the overall cluster performance because of the flow control issues. The node which is executing the read job is overloaded and delays the certification and writes apply process. The read job queries can’t be split across the cluster.  So, they don’t want that particular node as a part of the cluster during the report generation. So, I recommended this approach. The overall job will take 3-4 hours. During that particular time, the topology will be 4 node clusters and one asynchronous replica. Once the job is completed, the async replica node will be again joined to the GR cluster. 

For testing this, I have installed and configured the group replication cluster with 5 nodes ( gr1,gr2,gr3,gr4,gr5 ). The cluster is operating with a single primary mode.

Using Percona Server for MySQL 8.0.22.

 

Percona Live ONLINE, the open source database conference, is coming up! Registration is now OPEN… and FREE! 

 

How to Convert the Group Replication Member to Asynchronous Replica?

To explain this topic, 

  • I am going to convert the group replication member “gr5” to an asynchronous replica.
  • The GR member “gr4” will be the source for “gr5”.

Current status:

Step 1: 

— Take out the node “gr5” from the cluster.

Current cluster status:

Current “gr5” status:

Step 2:

Update the connection parameters to not allow communication with other Cluster nodes. 

Step 3:

Remove the group replication channel configurations and the respective physical files. During the group replication configuration, it will create two channels and the respective files (applier/recovery files). 

We can remove them by resetting the replica status.

Step 4:

Configure asynchronous replication. To configure, we don’t need to manually update the binlog/gtid positions. Group replication will run based on the GTID. The node was already configured as a member in the same group so it should already have the GTID entries. 

Just need to run the CHANGE MASTER command.

So, finally, the current topology is:

  • We have 4 node group replication clusters ( gr1, gr2, gr3, gr4 ).
  • The node “gr5” is configured as an async replica under the “gr4”.

How to Convert the Async Replica to Group Replication Member?

To explain this topic: 

  • I am going to break the asynchronous replication on “gr5”.
  • Then, I will join the node “gr5” to the group replication cluster.

Step 1:

Break replication on “gr5” and reset the replica.

Step 2:

Configure the connection parameters to join to the cluster. 

Step 3:

Configure the channel for “group_replication_recovery”. 

Note: No need to configure the GTID parameters before starting the group replication service, because the node was already configured as an async replica in the same group. So, when starting the group replication service, it will automatically start with the last GTID position executed by async replication and start to sync the rest of the data.

Step 4:

Start the group replication service

Final status:

I hope this blog post will be helpful to someone, who is learning or working with MySQL Group replication.

Cheers!

Percona Distribution for MySQL is the most complete, stable, scalable, and secure, open-source MySQL solution available, delivering enterprise-grade database environments for your most critical business applications… and it’s free to use!

Download Percona Distribution for MySQL Today