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:
- 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) - run the utility to verify if the upgrade is possible (check this post)
- 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 andmysqd
stopped properly - upgrade the binaries
- edit the configuration to disable group replication at boot and to remove all eventual configuration settings that have been removed
- start
mysqld
- run
mysql_upgrade
- enable group replication at boot again (or if you don’t want, after the mandatory restart due to
mysql_upgrade
, you can usecluster.rejoinInstance()
from MySQL Shell) - 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 !
I believe the upgrade will fail if you have the following in your my.cnf
disabled_storage_engines=”MyISAM,BLACKHOLE,FEDERATED,ARCHIVE”
[…] April, I already posted an article on how to upgrade safely your MySQL InnoDB Cluster, let’s review this procedure now that MySQL 8.0.12 is […]
[…] April, I already posted an article on how to upgrade safely your MySQL InnoDB Cluster, let’s review this procedure now that MySQL 8.0.12 is […]
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
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.
Please read it as 5.7