Step-by-Step Guide to Upgrading MySQL Group Replication (MGR) from 5.7 to 8.0.26
This article provides a detailed, online, in‑place upgrade procedure for MySQL InnoDB Cluster (MGR) from version 5.7.25 single‑primary mode to version 8.0.26, covering preparation, backup, node‑by‑node upgrade, configuration changes, and communication‑protocol updates.
1. Determine MGR mode and version
Check whether the cluster is in single‑primary mode and identify the primary node and each instance's MySQL version.
show variables like '%group_replication_single_primary_mode%'; select * from performance_schema.replication_group_members; SHOW STATUS LIKE 'group_replication_primary_member'; select @@version;In MySQL 8 you can verify everything with a single query:
select * from performance_schema.replication_group_members;2. Backup the database
Perform a full backup before starting the upgrade to allow rollback if needed.
3. Upgrade the first replica
3.1 Install MySQL Shell
Download and install the MySQL Shell package:
https://dev.mysql.com/downloads/repo/yum/
rpm -Uvh mysql80-community-release-el7-3.noarch.rpm
yum install -y mysql-shell3.2 Check compatibility and fix issues
mysqlsh --util check-for-server-upgrade { --user=root --socket=/opt/mysql/data/3307/mysqld.sock } --target-version=8.0.26 --output-format=JSON --config-path=/opt/mysql/etc/3307/my.cnf3.3 Stop group replication
stop group_replication;3.4 Shut down the instance
SET GLOBAL innodb_fast_shutdown=0;
systemctl stop mysqld_33063.5 Install the new MySQL binaries
tar xf mysql-8.0.26-linux-glibc2.12-x86_64.tar.xz -C /opt/mysql/base/Replace the old base directory or symlink:
rm -rf /opt/mysql/base/5.7.25/
ln -s mysql-8.0.26-linux-glibc2.12-x86_64/ /opt/mysql/base/5.7.253.6 Start the upgraded instance with auto‑upgrade
/opt/mysql/base/5.7.25/bin/mysqld --defaults-file=/opt/mysql/etc/3306/my.cnf --daemonize --pid-file=/opt/mysql/data/3306/mysqld.pid --user=actiontech-mysql --socket=/opt/mysql/data/3306/mysqld.sock --port=3306 --upgrade=autoAfter the upgrade the server does not need a restart, and subsequent starts omit the --upgrade=auto flag.
3.7 Re‑join the replica to the cluster
RESET SLAVE ALL;
set global group_replication_group_name="964fe9c5-03e4-11ec-8aa2-02000aba4034";
SET GLOBAL group_replication_local_address = "10.186.64.71:33061";
SET GLOBAL group_replication_group_seeds = "10.186.64.52:33061";
SET GLOBAL group_replication_bootstrap_group = OFF;
CHANGE MASTER TO MASTER_USER="repl",MASTER_PASSWORD="repl" FOR CHANNEL "group_replication_recovery";
START GROUP_REPLICATION;
select * from performance_schema.replication_group_members;4. Upgrade the primary node
Repeat the same steps as for the replica. After stopping group replication the primary will automatically fail‑over; verify the new primary before proceeding.
SET GLOBAL group_replication_local_address = "10.186.64.71:33061";
SET GLOBAL group_replication_group_seeds = "10.186.64.52:33061";5. Change the primary back to the original host (if needed)
SELECT group_replication_set_as_primary('ab8900ff-03e4-11ec-b68a-02000aba4034');6. Upgrade the communication protocol
After the cluster version is upgraded, the communication protocol remains at the old version and must be updated manually.
6.1 Check current protocol
SELECT group_replication_get_communication_protocol();6.2 Set the new protocol
SELECT group_replication_set_communication_protocol("8.0.26");6.3 Verify the change
SELECT group_replication_get_communication_protocol();Following these steps completes a safe, online, in‑place upgrade of a MySQL 5.7 single‑primary MGR cluster to MySQL 8.0.26.
Aikesheng Open Source Community
The Aikesheng Open Source Community provides stable, enterprise‑grade MySQL open‑source tools and services, releases a premium open‑source component each year (1024), and continuously operates and maintains them.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.