Upgrading your Galera Cluster from MySQL 5.7 to MySQL 8.0

Recently we had a question on getting your Galera Cluster upgraded from MySQL 5.7 to MySQL 8.0. While we have plenty of extensive documentation on Upgrading Galera Cluster, this blog covers the Linux example for a rolling major upgrade (the procedure is documented, but this is more extensive). So we will describe going from MySQL 5.7.23 to MySQL 8.0.28 on one node. We did this on CentOS 7.

Firstly, let’s start by disabling SELinux by executing setenforce 0.

We need to install the appropriate MySQL 5.7 binaries, so we can grab them from releases.galeracluster.com. Since we have decided on MySQL 5.7.23, we should get the packages from https://releases.galeracluster.com/mysql-wsrep-5.7.23-25.15/centos/7/x86_64/. This is the current set:


We have to match a Galera library version, so a bit of searching found this blog post from September 2018 which included that the release would be powered by Galera 3.24, so a quick wget https://releases.galeracluster.com/galera-3.24/centos/7/x86_64/galera-3-25.3.24-2.el7.x86_64.rpm to ensure that we have it too.

Now that all of this is in the same directory, as the root user, we do yum localinstall *.rpm.

Now we edit the my.cnf making sure the wsrep_provider=/usr/lib64/galera-3/libgalera_smm.so is set. We start node 1 with mysqld_bootstrap --wsrep-new-cluster and then, grep 'temporary password' /var/log/mysqld.log, followed by logging into MySQL and changing the password.

mysql> select version();
| version() |
| 5.7.23    |
1 row in set (0.00 sec)

mysql> show status like 'wsrep_cluster_size';
| Variable_name      | Value |
| wsrep_cluster_size | 1     |
1 row in set (0.00 sec)

| wsrep_cluster_status         | Primary                                     |
| wsrep_connected              | ON                                          |
| wsrep_local_bf_aborts        | 0                                           |
| wsrep_local_index            | 0                                           |
| wsrep_provider_name          | Galera                                      |
| wsrep_provider_vendor        | Codership Oy <info@codership.com>           |
| wsrep_provider_version       | 3.24(rf216443)                              |
| wsrep_ready                  | ON                                          |

The above shows the 5.7.23 version, with one node in the cluster, plus the wsrep_provider_version set at 3.24. Remember to ensure that all this is done across the other three nodes till you have a working 3-node Galera Cluster.

Now, let’s upgrade it node by node.

We execute systemctl stop mysqld on a node. We change the /etc/yum.repos.d/galera.repo to now read as follows:

name = Galera
baseurl = https://releases.galeracluster.com/galera-4/centos/7/x86_64
gpgkey = https://releases.galeracluster.com/GPG-KEY-galeracluster.com
gpgcheck = 1

name = MySQL-wsrep
baseurl = https://releases.galeracluster.com/mysql-wsrep-8.0/centos/7/x86_64
gpgkey = https://releases.galeracluster.com/GPG-KEY-galeracluster.com
gpgcheck = 1

You would think it is as simple as a yum install galera-4 mysql-wsrep-8.0 but if you do so, you’ll find transaction check errors from the install due to conflicts. So you should first execute:

yum remove mysql-wsrep-5.7 mysql-wsrep-libs-5.7 mysql-wsrep-server-5.7 mysql-wsrep-common-5.7 mysql-wsrep-client-5.7 mysql-wsrep-libs-compat-5.7 galera-3

And only then do you do the yum install galera-4 mysql-wsrep-8.0.

Now, you can start it up as per previously, and you’ll notice you’ve upgraded that particular node to MySQL 8.0.28.

mysql> select version();
| version() |
| 8.0.28    |
1 row in set (0.00 sec)

| wsrep_provider_name          | Galera                                                                                                                                          |
| wsrep_provider_vendor        | Codership Oy <info@codership.com>                                                                                                               |
| wsrep_provider_version       | 4.12(r63116854)                                                                                                                                 |
| wsrep_ready                  | ON                                                                                                                                              |
66 rows in set (0.00 sec)

And that is all. While our current documentation mentions that you need to run mysql_upgrade, it is worth noting that after MySQL 8.0.16, mysql_upgrade is deprecated and the functionality is built into the server. Feel free to read more in mysql_upgrade — Check and Upgrade MySQL Tables.

If you have any questions about upgrades, don’t hesitate to drop us a line at our Google Group, or even consider getting a Galera Cluster Enterprise Edition (EE) subscription, which you can by sending an email to our friendly sales team at mailto:sales@galeracluster.com.