MySQL InnoDB Cluster & Group Replication: how to upgrade safely your cluster

on

Recently on MySQL Forums, somebody was looking for documentation or procedure to upgrade a MySQL InnoDB Cluster (or Group Replication cluster) to a newer version.

In this post I am illustrating the best practices to achieve this task safely.

To illustrate the procedure, I will use an InnoDB Cluster of 3 members: mysql1, mysql2 and mysql3. The cluster is setup in Single-Primary mode (mysql1) and runs MySQL 5.7.21.

Let’s have a look at the cluster status:

 MySQL / mysql1:3306 / JS / cluster.status()
{
    "clusterName": "MyCluster", 
    "defaultReplicaSet": {
        "name": "default", 
        "primary": "mysql1:3306", 
        "ssl": "DISABLED", 
        "status": "OK", 
        "statusText": "Cluster is ONLINE and can tolerate up to ONE failure.", 
        "topology": {
            "mysql1:3306": {
                "address": "mysql1:3306", 
                "mode": "R/W", 
                "readReplicas": {}, 
                "role": "HA", 
                "status": "ONLINE"
            }, 
            "mysql2:3306": {
                "address": "mysql2:3306", 
                "mode": "R/O", 
                "readReplicas": {}, 
                "role": "HA", 
                "status": "ONLINE"
            }, 
            "mysql3:3306": {
                "address": "mysql3:3306", 
                "mode": "R/O", 
                "readReplicas": {}, 
                "role": "HA", 
                "status": "ONLINE"
            }
        }
    }, 
    "groupInformationSourceMember": "mysql://clusteradmin@mysql1:3306"
}

Before upgrading a MySQL InnoDB Cluster, there is one important rule to remember: always write on the lowest version.

The procedure for such upgrade is the following:

  1. be sure you have saved the cluster (group replication) configuration to disk (in 8.0 no need to use ConfigureLocalInstance() as you can configure also remote instances)
  2. run the utility to verify if the upgrade is possible (check this post)
  3. stop safely one of the Secondary-Master nodes (mysql2 or mysql3 in our example). This means set innodb_fast_shutdown must be set to 0 and mysqd stopped properly
  4. upgrade the binaries
  5. edit the configuration to disable group replication at boot and to remove all eventual configuration settings that have been removed
  6. start mysqld
  7. run mysql_upgrade
  8. enable group replication at boot again (or if you don’t want, after the mandatory restart due to mysql_upgrade, you can use cluster.rejoinInstance() from MySQL Shell)
  9. start mysqld

That’s it !

Now you need to reproduce all these steps for each nodes and finish by the Primary-Master.

I’ve illustrated all this in the video below:

I hope this will help you if you are planning to upgrade your MySQL InnoDB Cluster to a newer version.

Enjoy MySQL HA made easy !

 

Leave a Reply

Your email address will not be published. Required fields are marked *

recent

Last Tweets

Locations of visitors to this page
categories