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

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 !

 

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

6 Comments

  1. I believe the upgrade will fail if you have the following in your my.cnf
    disabled_storage_engines=”MyISAM,BLACKHOLE,FEDERATED,ARCHIVE”

  2. Fred,

    Thank you very much for this blog post. I had scoured the web looking for a detailed step-by-step guide as you’ve detailed here, specifically to upgrade from 5.7.26 to 8.0.16.

    Appreciated

  3. Hi lefred. This is the post we were searching for quite a long time. Kindly provide us the way to upgrade MySQL InnoDB cluster 5.2 to 8.0 in Windows server. Also please be informed that we have deployed the cluster in Multi-Master primary mode.

    Awaiting your reply brother.

Leave a Reply

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

As MySQL Community Manager, I am an employee of Oracle and the views expressed on this blog are my own and do not necessarily reflect the views of Oracle.

You can find articles I wrote on Oracle’s blog.