暂无图片
暂无图片
2
暂无图片
暂无图片
暂无图片

MySQL InnoDB Cluster 8.0.44升级8.4.9升级指南

原创 飞天 2天前
64

一、背景说明

MySQL 8.0 系列已正式终止版本迭代,8.0.46 为该系列最终维护版本,后续不再提供任何功能更新与安全漏洞修复。为保障数据库的安全性、稳定性及合规性,现有 8.0.x 版本数据库需升级至官方长期支持的新版本。

本文基于本地虚拟机环境,详细记录 MySQL 8.0.44 升级至 MySQL 8.4.9 的全流程操作方案,为同场景升级需求提供专业、可落地的参考指南。

二、MySQL InnoDB Cluster 环境说明

主机名称 节点角色 IP地址 部署软件 数据库VIP地址
node1 数据库主节点(PRIMARY) 192.*.*.10 mysql shell 8.0.44
mysql router 8.0.44
mysql server 8.0.44
keepalived 2.3.4
192.*.*.13
node2 数据库从节点(SECONDARY) 192.*.*.11 mysql shell 8.0.44
mysql router 8.0.44
mysql server 8.0.44
keepalived 2.3.4
192.*.*.13
node3 数据库从节点(SECONDARY) 192.*.*.12 mysql shell 8.0.44
mysql router 8.0.44
mysql server 8.0.44
192.*.*.13

说明:由于历史原因,系统中mysql router和mysql shell都是使用rpm包安装的,MGR是使用二进制包安装的。

系统中已安装的mysql rpm包:

[root@node1 rpm]# rpm -qa|grep mysql mysql-router-community-8.0.44-1.el7.x86_64 mysql-shell-8.0.44-1.el7.x86_64

主机上运行的mysql进程:

[mysql@node1 data]$ ps -ef|grep mysql|grep -v grep root 47578 1 0 May11 pts/7 00:00:00 sudo ROUTER_PID=/etc/mysqlrouter/mysqlrouter.pid /usr/bin/mysqlrouter -c /etc/mysqlrouter/mysqlrouter.conf --user=mysql mysql 47579 47578 1 May11 pts/7 00:01:23 /usr/bin/mysqlrouter -c /etc/mysqlrouter/mysqlrouter.conf --user=mysql mysql 52278 51080 4 22:43 pts/5 00:00:35 /data/mysql/bin/mysqld --defaults-file=/data/my.cnf --user=mysql [mysql@node1 data]$

三、升级mysql shell

3.1 升级mysql shell包(8.0.44 -> 8.4.9)

在3个节点上都需要操作。

[root@node1 rpm]# rpm -Fvh mysql-shell-8.4.9-1.el7.x86_64.rpm warning: mysql-shell-8.4.9-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID a8d3785c: NOKEY Preparing... ################################# [100%] Updating / installing... 1:mysql-shell-8.4.9-1.el7 ################################# [ 50%] Cleaning up / removing... 2:mysql-shell-8.0.44-1.el7 ################################# [100%] [root@node1 rpm]#

3.2 升级innodb集群元数据(2.1.0 -> 2.2.0)

只在primary节点操作即可。

mysqlsh \c root@192.*.*.10:3306 \js dba.upgradeMetadata()

回显如下:

[root@node1 rpm]# mysqlsh MySQL Shell 8.4.9 Copyright (c) 2016, 2026, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type '\help' or '\?' for help; '\quit' to exit. MySQL SQL > \c root@192.*.*.10:3306 Creating a session to 'root@192.*.*.10:3306' Please provide the password for 'root@192.*.*.10:3306': ********* Save password for 'root@192.*.*.10:3306'? [Y]es/[N]o/Ne[v]er (default No): Fetching global names for auto-completion... Press ^C to stop. Your MySQL connection id is 9055 Server version: 8.0.44 MySQL Community Server - GPL No default schema selected; type \use <schema> to set one. MySQL 192.*.*.10:3306 ssl SQL > \js Switching to JavaScript mode... MySQL 192.*.*.10:3306 ssl JS > dba.upgradeMetadata() Metadata Schema Upgrade The topology you are connected to is using an outdated metadata schema version 2.1.0 and needs to be upgraded to 2.2.0. Without doing this upgrade, no AdminAPI calls except read only operations will be allowed. The grants for the MySQL Router accounts that were created automatically when bootstrapping need to be updated to match the new metadata version's requirements. Updating Router accounts... NOTE: 8 Router accounts have been updated. WARNING: If MySQL Routers have been bootstrapped using custom accounts, their grants can not be updated during the metadata upgrade, they have to be updated using the setupRouterAccount function. For additional information use: \? setupRouterAccount Upgrading metadata at '192.*.*.10:3306' from version 2.1.0 to version 2.2.0. Creating backup of the metadata schema... Step 1 of 1: upgrading from 2.1.0 to 2.2.0... ERROR: Access denied; you need (at least one of) the SYSTEM_USER privilege(s) for this operation <---注意:这里报错了 Restoring metadata to version 2.1.0... Dba.upgradeMetadata: 192.*.*.10:3306: Access denied; you need (at least one of) the SYSTEM_USER privilege(s) for this operation (MYSQLSH 1227) MySQL 192.*.*.10:3306 ssl JS > \q Bye!

Dba.upgradeMetadata报错了,错误提示: Access denied; you need (at least one of) the SYSTEM_USER privilege(s) for this operation (MYSQLSH 1227)。
解决办法:在primary节点给root账号授予SYSTEM_USER权限。如下:

GRANT SYSTEM_USER ON *.* TO 'root'@'localhost'; GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION; FLUSH PRIVILEGES; GRANT SYSTEM_USER ON *.* TO 'root'@'192.*.*.%'; GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.*.*.%' WITH GRANT OPTION; FLUSH PRIVILEGES;

3.3 再次升级innodb集群元数据(2.1.0 -> 2.2.0)

[root@node1 rpm]# mysqlsh MySQL Shell 8.4.9 Copyright (c) 2016, 2026, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type '\help' or '\?' for help; '\quit' to exit. MySQL SQL > \c root@192.*.*.10:3306 Creating a session to 'root@192.*.*.10:3306' Please provide the password for 'root@192.*.*.10:3306': ********* Save password for 'root@192.*.*.10:3306'? [Y]es/[N]o/Ne[v]er (default No): Fetching global names for auto-completion... Press ^C to stop. Your MySQL connection id is 12554 Server version: 8.0.44 MySQL Community Server - GPL No default schema selected; type \use <schema> to set one. MySQL 192.*.*.10:3306 ssl SQL > \js Switching to JavaScript mode... MySQL 192.*.*.10:3306 ssl JS > dba.upgradeMetadata() WARNING: An unfinished metadata upgrade was detected, which may have left it in an invalid state. The metadata will be restored to version 2.1.0. <--- 这个提示正常:是因为之前更新过一次集群元数据失败了,需要把元数据恢复。 Restoring metadata to version 2.1.0... Removing metadata backup... MySQL 192.*.*.10:3306 ssl JS > dba.upgradeMetadata() <--- 再次执行,集群元数据升级成功。 Metadata Schema Upgrade The topology you are connected to is using an outdated metadata schema version 2.1.0 and needs to be upgraded to 2.2.0. Without doing this upgrade, no AdminAPI calls except read only operations will be allowed. The grants for the MySQL Router accounts that were created automatically when bootstrapping need to be updated to match the new metadata version's requirements. Updating Router accounts... NOTE: 8 Router accounts have been updated. WARNING: If MySQL Routers have been bootstrapped using custom accounts, their grants can not be updated during the metadata upgrade, they have to be updated using the setupRouterAccount function. For additional information use: \? setupRouterAccount Upgrading metadata at '192.*.*.10:3306' from version 2.1.0 to version 2.2.0. Creating backup of the metadata schema... Step 1 of 1: upgrading from 2.1.0 to 2.2.0... Removing metadata backup... Upgrade process successfully finished, metadata schema is now on version 2.2.0 MySQL 192.*.*.10:3306 ssl JS >

四、mysql router升级

注意:步骤 4.1-4.4 在3个节点上都需要操作。以下操作都以node1主节点为例,其他两个节点操作方式相同。

4.1 备份mysql router配置文件

ps -ef|grep mysqlrouter cp /etc/mysqlrouter/mysqlrouter.conf /etc/mysqlrouter/mysqlrouter.conf.bak

4.2 关停mysql router进程

ps -ef |grep mysqlrouter cd /etc/mysqlrouter sh stop.sh

执行回显如下:

[mysql@node1 ~]$ ps -ef|grep mysqlrouter root 3753 1 0 May10 ? 00:00:00 sudo ROUTER_PID=/etc/mysqlrouter/mysqlrouter.pid /usr/bin/mysqlrouter -c /etc/mysqlrouter/mysqlrouter.conf --user=mysql mysql 3754 3753 1 May10 ? 00:28:09 /usr/bin/mysqlrouter -c /etc/mysqlrouter/mysqlrouter.conf --user=mysql mysql 49430 28973 0 15:27 pts/4 00:00:00 grep --color=auto mysqlrouter [mysql@node1 ~]$ cp /etc/mysqlrouter/mysqlrouter.conf /etc/mysqlrouter/mysqlrouter.conf.bak [mysql@node1 ~]$ exit logout [root@node1 rpm]# cd /etc/mysqlrouter [root@node1 rpm]# sh stop.sh [root@node1 rpm]# ps -ef|grep mysqlrouter root 50312 8182 0 15:29 pts/4 00:00:00 grep --color=auto mysqlrouter

4.3 升级mysql router包(8.0.44 -> 8.4.9)

rpm -Fvh mysql-router-community-8.4.9-1.el7.x86_64.rpm rpm -qa|grep mysql

执行回显如下:

[root@node1 rpm]# rpm -Fvh mysql-router-community-8.4.9-1.el7.x86_64.rpm warning: mysql-router-community-8.4.9-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID a8d3785c: NOKEY Preparing... ################################# [100%] Updating / installing... 1:mysql-router-community-8.4.9-1.elwarning: /etc/mysqlrouter/mysqlrouter.conf created as /etc/mysqlrouter/mysqlrouter.conf.rpmnew ################################# [ 50%] Cleaning up / removing... 2:mysql-router-community-8.0.44-1.e################################# [100%] [root@node1 rpm]# [root@node1 rpm]# rpm -qa|grep mysql mysql-shell-8.4.9-1.el7.x86_64 mysql-router-community-8.4.9-1.el7.x86_64 [root@node1 rpm]#

4.4 启动mysqlrouter

cd /etc/mysqlrouter sh start.sh /usr/bin/mysqlrouter -c /etc/mysqlrouter/mysqlrouter.conf & --查看router日志 tail -f /etc/mysqlrouter/log/mysqlrouter.log

启动mysql router碰到的问题:

[root@node1 ~]# tail -f /etc/mysqlrouter/log/mysqlrouter.log 2026-05-11 15:42:21 metadata_cache INFO [7fcea87f8700] Connected with metadata server running on 192.*.*.10:3306 2026-05-11 15:42:21 metadata_cache INFO [7fcea87f8700] New router options read from the metadata '{}', was '' 2026-05-11 15:42:21 metadata_cache INFO [7fcea87f8700] Using unreachable_quorum_allowed_traffic='none' 2026-05-11 15:42:21 metadata_cache INFO [7fcea87f8700] Using read_only_targets='secondaries' 2026-05-11 15:42:21 metadata_cache INFO [7fcea87f8700] Potential changes detected in cluster after metadata refresh (view_id=0) 2026-05-11 15:42:21 metadata_cache INFO [7fcea87f8700] Metadata for cluster 'mycluster' has 3 member(s), single-primary: 2026-05-11 15:42:21 metadata_cache INFO [7fcea87f8700] 192.*.*.10:3306 / 33060 - mode=RW 2026-05-11 15:42:21 metadata_cache INFO [7fcea87f8700] 192.*.*.12:3306 / 33060 - mode=RO 2026-05-11 15:42:21 metadata_cache INFO [7fcea87f8700] 192.*.*.11:3306 / 33060 - mode=RO 2026-05-11 15:42:21 main ERROR [7fceb5775880] Error: routing:bootstrap_ro: Failed setting up acceptor on '/etc/mysqlrouter/mysqlro.sock': Permission denied

原因:
8.4.9 新版本安装 / 升级过程会重置配置目录权限,安装脚本把 /etc/mysqlrouter 归属改成了 root:root,但 Router 服务依然以 mysql 用户 运行,导致权限不匹配,直接无法创建 socket。
解决办法:

chown -R mysql:mysql /etc/mysqlrouter

4.5 测试通过mysql router连接数据库是否正常

/data/mysql/bin/mysql -h 192.*.*.13 -uroot -p -P38294 -e "select @@hostname;" /data/mysql/bin/mysql -h 192.*.*.13 -uroot -p -P38295 -e "select @@hostname;" /data/mysql/bin/mysql -h 192.*.*.13 -uroot -p -P38295 -e "select @@hostname;"

回显如下:

[mysql@node1 mysqlrouter]$ /data/mysql/bin/mysql -h 192.*.*.13 -uroot -p'******' -P38294 -e "select @@hostname;" mysql: [Warning] Using a password on the command line interface can be insecure. +------------+ | @@hostname | +------------+ | node1 | +------------+ [mysql@node1 mysqlrouter]$ /data/mysql/bin/mysql -h 192.*.*.13 -uroot -p'******' -P38295 -e "select @@hostname;" mysql: [Warning] Using a password on the command line interface can be insecure. +------------+ | @@hostname | +------------+ | node3 | +------------+ [mysql@node1 mysqlrouter]$ /data/mysql/bin/mysql -h 192.*.*.13 -uroot -p'******' -P38295 -e "select @@hostname;" mysql: [Warning] Using a password on the command line interface can be insecure. +------------+ | @@hostname | +------------+ | node2 | +------------+ [mysql@node1 mysqlrouter]$

五、db升级(8.0.44 -> 8.4.9)

5.1 node2从节点先升级,升级兼容性检查

在从节点执行,以免主库负载高影响业务。
本文的node2和node3都是从节点,在node2节点执行:

##假设数据库配置文件路径为:/data/my.cnf(需要根据实际环境修改,默认安装是/etc/my.cnf) mysqlsh --uri root@localhost:3306 --js -e "util.checkForServerUpgrade('root@node2:3306',{'targetVersion':'8.4.9','configPath':'/data/my.cnf'});">check_upgrade.txt cat check_upgrade.txt

执行回显如下:

[mysql@node2 ~]$ mysqlsh --uri root@localhost:3306 --get-server-public-key --js -e "util.checkForServerUpgrade('root@node2:3306',{'targetVersion':'8.4.9','configPath':'/data/my.cnf'});">check_upgrade.txt Please provide the password for 'root@localhost:3306': X Protocol: Option get-server-public-key is not supported. [mysql@node2 ~]$ mysqlsh --uri root@localhost:3306 --js -e "util.checkForServerUpgrade('root@node2:3306',{'targetVersion':'8.4.9','configPath':'/data/my.cnf'});">check_upgrade.txt Please provide the password for 'root@localhost:3306': ********* Please provide the password for 'root@node2:3306': ********* Check failed: ERROR: 4 errors were found. Please correct these issues before upgrading to avoid compatibility issues. [mysql@node2 ~]$ cat check_upgrade.txt Save password for 'root@localhost:3306'? [Y]es/[N]o/Ne[v]er (default NThe MySQL server at node2:3306, version 8.0.44 - MySQL Community Server - GPL, will now be checked for compatibility issues for upgrade to MySQL 8.4.9. 1) Removed system variables (removedSysVars) Error: Following system variables that were detected as being used will be removed. Please update your system to not rely on them before the upgrade. binlog_transaction_dependency_tracking - Error: The system variable 'binlog_transaction_dependency_tracking' is set to WRITESET (PERSISTED) and will be removed. master_info_repository - Error: The system variable 'master_info_repository' is set to TABLE (EXPLICIT) and will be removed. relay_log_info_repository - Error: The system variable 'relay_log_info_repository' is set to TABLE (EXPLICIT) and will be removed. transaction_write_set_extraction - Error: The system variable 'transaction_write_set_extraction' is set to XXHASH64 (EXPLICIT) and will be removed. More information: https://dev.mysql.com/doc/refman/8.0/en/added-deprecated-removed.html#optvars-removed 2) System variables with new default values (sysVarsNewDefaults) Warning: Following system variables that are not defined in your configuration file will have new default values. Please review if you rely on their current values and if so define them before performing upgrade. group_replication_exit_state_action - default value will change from READ_ONLY to OFFLINE_MODE. innodb_adaptive_hash_index - default value will change from ON to OFF. innodb_buffer_pool_in_core_file - default value will change from ON to OFF. innodb_buffer_pool_instances - default value will change from 8 (or 1 if innodb_buffer_pool_size < 1GB) to MAX(1, #vcpu/4). innodb_change_buffering - default value will change from all to none. innodb_doublewrite_files - default value will change from innodb_buffer_pool_instances * 2 to 2. innodb_doublewrite_pages - default value will change from innodb_write_io_threads to 128. innodb_flush_method - default value will change from fsynch (unix) or unbuffered (windows) to O_DIRECT. innodb_io_capacity - default value will change from 200 to 10000. innodb_io_capacity_max - default value will change from 200 to 2 x innodb_io_capacity. innodb_log_buffer_size - default value will change from 16777216 (16MB) to 67108864 (64MB). innodb_log_writer_threads - default value will change from ON to OFF ( if #vcpu <= 32 ). innodb_numa_interleave - default value will change from OFF to ON. innodb_page_cleaners - default value will change from 4 to innodb_buffer_pool_instances. innodb_parallel_read_threads - default value will change from 4 to MAX(#vcpu/8, 4). innodb_purge_threads - default value will change from 4 to 1 ( if #vcpu <= 16 ). innodb_read_io_threads - default value will change from 4 to MAX(#vcpu/2, 4). innodb_redo_log_capacity - default value will change from 104857600 (100MB) to MIN ( #vcpu/2, 16 )GB. More information: https://dev.mysql.com/blog-archive/new-defaults-in-mysql-8-0/ 3) Issues reported by 'check table x for upgrade' command (checkTableCommand) The MySQL server is running with the --super-read-only option so it cannot execute this statement 4) Checks for foreign keys not referencing a full unique index (foreignKeyReferences) No issues found 5) Check for deprecated or invalid user authentication methods. (authMethodUsage) No issues found 6) Check for deprecated or removed plugin usage. (pluginUsage) No issues found 7) Check for deprecated or invalid default authentication methods in system variables. (deprecatedDefaultAuth) No issues found 8) Check for deprecated or invalid authentication methods in use by MySQL Router internal accounts. (deprecatedRouterAuthMethod) No issues found 9) Checks for errors in column definitions (columnDefinition) No issues found 10) Check for allowed values in System Variables. (sysvarAllowedValues) No issues found 11) Checks for user privileges that will be removed (invalidPrivileges) Verifies for users containing grants to be removed as part of the upgrade process. Notice: The following users have the SET_USER_ID privilege which will be removed as part of the upgrade process: - 'root'@'localhost' Solution: - If the privileges are not being used, no action is required, otherwise, ensure they stop being used before the upgrade as they will be lost. 12) Checks for partitions by key using columns with prefix key indexes (partitionsWithPrefixKeys) No issues found Errors: 4 Warnings: 18 Notices: 1 [mysql@node2 ~]$

5.2 修正4个errors

-- 清除已移除的系统变量 RESET PERSIST IF EXISTS binlog_transaction_dependency_tracking; RESET PERSIST IF EXISTS master_info_repository; RESET PERSIST IF EXISTS relay_log_info_repository; RESET PERSIST IF EXISTS transaction_write_set_extraction; --编辑配置文件/data/my.cnf,把下面这些行全部删除: binlog_transaction_dependency_tracking = WRITESET master_info_repository = TABLE relay_log_info_repository = TABLE transaction_write_set_extraction = XXHASH64 --关闭数据库、重启: stop group_replication; shutdown; /data/mysql/bin/mysqld --defaults-file=/data/my.cnf --user=mysql & -- 检查mgr集群是否正常 mysql -uroot -p'******' -S '/data/data/mysql.sock' -e "SELECT * FROM performance_schema.replication_group_members;"

执行回显如下:

mysql> RESET PERSIST IF EXISTS binlog_transaction_dependency_tracking; Query OK, 0 rows affected (0.00 sec) mysql> RESET PERSIST IF EXISTS master_info_repository; Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> RESET PERSIST IF EXISTS relay_log_info_repository; Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> RESET PERSIST IF EXISTS transaction_write_set_extraction; Query OK, 0 rows affected, 1 warning (0.00 sec) mysql>

vi /data/my.cnf,注释下面几行:

#binlog_transaction_dependency_tracking = WRITESET #master_info_repository = TABLE #relay_log_info_repository = TABLE #transaction_write_set_extraction = XXHASH64

关闭数据库、重启数据库、验证mgr集群是否正常:

mysql> stop group_replication; Query OK, 0 rows affected (3.86 sec) mysql> shutdown; Query OK, 0 rows affected (0.01 sec) mysql> \q Bye [mysql@node2 ~]$ which mysqld /data/mysql/bin/mysqld [mysql@node2 ~]$ /data/mysql/bin/mysqld --defaults-file=/data/my.cnf --user=mysql & [1] 26316 [mysql@node2 ~]$ [mysql@node2 ~]$ mysql -uroot -p'******' -S '/data/data/mysql.sock' -e "SELECT * FROM performance_schema.replication_group_members;" mysql: [Warning] Using a password on the command line interface can be insecure. +---------------------------+--------------------------------------+----------------+-------------+--------------+-------------+----------------+----------------------------+ | CHANNEL_NAME | MEMBER_ID | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE | MEMBER_ROLE | MEMBER_VERSION | MEMBER_COMMUNICATION_STACK | +---------------------------+--------------------------------------+----------------+-------------+--------------+-------------+----------------+----------------------------+ | group_replication_applier | 05c27710-1843-11ef-80a9-00505621b833 | 192.*.*.12 | 3306 | ONLINE | PRIMARY | 8.0.44 | MySQL | | group_replication_applier | 122d7061-1843-11ef-8ddb-005056286a23 | 192.*.*.10 | 3306 | ONLINE | SECONDARY | 8.0.44 | MySQL | | group_replication_applier | 141bfb53-1843-11ef-b4e7-005056393b43 | 192.*.*.11 | 3306 | ONLINE | SECONDARY | 8.0.44 | MySQL | +---------------------------+--------------------------------------+----------------+-------------+--------------+-------------+----------------+----------------------------+ [mysql@node2 ~]$

5.3 关闭 8.0.44 数据库

mysql> stop group_replication; Query OK, 0 rows affected (3.86 sec) mysql> shutdown; Query OK, 0 rows affected (0.01 sec) mysql> \q Bye

5.4 解压 8.4.9 的mysql软件

chown -R mysql:mysql /data/mysql-8.4.9-linux-glibc2.17-x86_64.tar.xz su - mysql tar -xf mysql-8.4.9-linux-glibc2.17-x86_64.tar.xz -C /data

执行过程回显如下:

[mysql@node2 data]$ tar -xf mysql-8.4.9-linux-glibc2.17-x86_64.tar.xz [mysql@node2 data]$ ls data my.cnf mysql mysql-8.4.9-linux-glibc2.17-x86_64 mysql-8.4.9-linux-glibc2.17-x86_64.tar.xz mysqlrouter mysqlshold [mysql@node2 data]$ mv mysql mysql8044 [mysql@node2 data]$ mv mysql-8.4.9-linux-glibc2.17-x86_64 mysql [mysql@node2 data]$ ls data my.cnf mysql mysql8044 mysql-8.4.9-linux-glibc2.17-x86_64.tar.xz mysqlrouter mysqlshold

5.5 启动数据库

/data/mysql/bin/mysqld --defaults-file=/data/my.cnf --user=mysql & ##查看数据库日志 tail -100f /data/data/error.log mysql -uroot -p'******' -S '/data/data/mysql.sock' -e "SELECT * FROM performance_schema.replication_group_members;"

执行过程回显如下:

[mysql@node2 data]$ /data/mysql/bin/mysqld --defaults-file=/data/my.cnf --user=mysql & [1] 17128 [mysql@node2 data]$ tail -100f /data/data/error.log ... 2026-05-11T23:59:31.816568+08:00 0 [Warning] [MY-011068] [Server] The syntax 'log_slave_updates' is deprecated and will be removed in a future release. Please use log_replica_updates instead. 2026-05-11T23:59:31.816582+08:00 0 [Warning] [MY-011070] [Server] 'binlog_format' is deprecated and will be removed in a future release. 2026-05-11T23:59:31.816700+08:00 0 [System] [MY-010116] [Server] /data/mysql/bin/mysqld (mysqld 8.4.9) starting as process 17128 2026-05-11T23:59:31.935047+08:00 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2026-05-11T23:59:32.504433+08:00 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2026-05-11T23:59:32.652754+08:00 1 [System] [MY-011090] [Server] Data dictionary upgrading from version '80023' to '80300'. 2026-05-11T23:59:33.448138+08:00 1 [System] [MY-013413] [Server] Data dictionary upgrade from version '80023' to '80300' completed. 2026-05-11T23:59:33.609178+08:00 0 [System] [MY-013587] [Repl] Plugin group_replication reported: 'Plugin 'group_replication' is starting.' 2026-05-11T23:59:33.609224+08:00 0 [Warning] [MY-011069] [Server] The syntax 'group_replication_view_change_uuid' is deprecated and will be removed in a future release. 2026-05-11T23:59:33.609601+08:00 0 [System] [MY-014010] [Repl] Plugin group_replication reported: 'Plugin 'group_replication' has been started.' 2026-05-11T23:59:34.532116+08:00 7 [System] [MY-013381] [Server] Server upgrade from '80044' to '80409' started. 2026-05-11T23:59:36.606036+08:00 7 [System] [MY-013381] [Server] Server upgrade from '80044' to '80409' completed. 2026-05-11T23:59:36.721231+08:00 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed. 2026-05-11T23:59:36.721282+08:00 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel. 2026-05-11T23:59:36.734314+08:00 0 [Warning] [MY-010604] [Repl] Neither --relay-log nor --relay-log-index were used; so replication may break when this MySQL server acts as a replica and has his hostname changed!! Please use '--relay-log=node2-relay-bin' to avoid this problem. 2026-05-11T23:59:36.745416+08:00 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /tmp/mysqlx.sock 2026-05-11T23:59:36.745430+08:00 0 [System] [MY-010931] [Server] /data/mysql/bin/mysqld: ready for connections. Version: '8.4.9' socket: '/data/data/mysql.sock' port: 3306 MySQL Community Server - GPL. ... ... [mysql@node2 data]$ mysql -uroot -p'******' -S '/data/data/mysql.sock' -e "SELECT * FROM performance_schema.replication_group_members;" mysql: [Warning] Using a password on the command line interface can be insecure. +---------------------------+--------------------------------------+----------------+-------------+--------------+-------------+----------------+----------------------------+ | CHANNEL_NAME | MEMBER_ID | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE | MEMBER_ROLE | MEMBER_VERSION | MEMBER_COMMUNICATION_STACK | +---------------------------+--------------------------------------+----------------+-------------+--------------+-------------+----------------+----------------------------+ | group_replication_applier | 05c27710-1843-11ef-80a9-00505621b833 | 192.*.*.12 | 3306 | ONLINE | SECONDARY | 8.0.44 | MySQL | | group_replication_applier | 122d7061-1843-11ef-8ddb-005056286a23 | 192.*.*.10 | 3306 | ONLINE | PRIMARY | 8.0.44 | MySQL | | group_replication_applier | 141bfb53-1843-11ef-b4e7-005056393b43 | 192.*.*.11 | 3306 | ONLINE | SECONDARY | 8.4.9 | MySQL | +---------------------------+--------------------------------------+----------------+-------------+--------------+-------------+----------------+----------------------------+ [mysql@node2 data]$

可以看到,node2从节点成功升级到了8.4.9版本。

5.6 node3从节点升级

操作方式同node2,略
数据库启动加入集群后,检查集群状态

[mysql@node3 data]$ mysql -uroot -p'******' -S '/data/data/mysql.sock' -e "SELECT * FROM performance_schema.replication_group_members;" mysql: [Warning] Using a password on the command line interface can be insecure. +---------------------------+--------------------------------------+----------------+-------------+--------------+-------------+----------------+----------------------------+ | CHANNEL_NAME | MEMBER_ID | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE | MEMBER_ROLE | MEMBER_VERSION | MEMBER_COMMUNICATION_STACK | +---------------------------+--------------------------------------+----------------+-------------+--------------+-------------+----------------+----------------------------+ | group_replication_applier | 05c27710-1843-11ef-80a9-00505621b833 | 192.*.*.12 | 3306 | ONLINE | SECONDARY | 8.4.9 | MySQL | | group_replication_applier | 122d7061-1843-11ef-8ddb-005056286a23 | 192.*.*.10 | 3306 | ONLINE | PRIMARY | 8.0.44 | MySQL | | group_replication_applier | 141bfb53-1843-11ef-b4e7-005056393b43 | 192.*.*.11 | 3306 | ONLINE | SECONDARY | 8.4.9 | MySQL | +---------------------------+--------------------------------------+----------------+-------------+--------------+-------------+----------------+----------------------------+

5.7 node1主节点升级

操作方式同node2,略
数据库启动加入集群后,检查集群状态

[mysql@node1 data]$ mysql -uroot -p'******' -S '/data/data/mysql.sock' -e "SELECT * FROM performance_schema.replication_group_members;" mysql: [Warning] Using a password on the command line interface can be insecure. +---------------------------+--------------------------------------+----------------+-------------+--------------+-------------+----------------+----------------------------+ | CHANNEL_NAME | MEMBER_ID | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE | MEMBER_ROLE | MEMBER_VERSION | MEMBER_COMMUNICATION_STACK | +---------------------------+--------------------------------------+----------------+-------------+--------------+-------------+----------------+----------------------------+ | group_replication_applier | 05c27710-1843-11ef-80a9-00505621b833 | 192.*.*.12 | 3306 | ONLINE | PRIMARY | 8.4.9 | MySQL | | group_replication_applier | 122d7061-1843-11ef-8ddb-005056286a23 | 192.*.*.10 | 3306 | ONLINE | SECONDARY | 8.4.9 | MySQL | | group_replication_applier | 141bfb53-1843-11ef-b4e7-005056393b43 | 192.*.*.11 | 3306 | ONLINE | SECONDARY | 8.4.9 | MySQL | +---------------------------+--------------------------------------+----------------+-------------+--------------+-------------+----------------+----------------------------+ [mysql@node1 data]$

5.8 node1切换为新primary节点

[mysql@node1 data]$ mysql -uroot -p'******' -S '/data/data/mysql.sock' -e "SELECT group_replication_set_as_primary('122d7061-1843-11ef-8ddb-005056286a23');" mysql: [Warning] Using a password on the command line interface can be insecure. +--------------------------------------------------------------------------+ | group_replication_set_as_primary('122d7061-1843-11ef-8ddb-005056286a23') | +--------------------------------------------------------------------------+ | Primary server switched to: 122d7061-1843-11ef-8ddb-005056286a23 | +--------------------------------------------------------------------------+ [mysql@node1 data]$ [mysql@node1 data]$ mysql -uroot -p'******' -S '/data/data/mysql.sock' -e "SELECT * FROM performance_schema.replication_group_members;" mysql: [Warning] Using a password on the command line interface can be insecure. +---------------------------+--------------------------------------+----------------+-------------+--------------+-------------+----------------+----------------------------+ | CHANNEL_NAME | MEMBER_ID | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE | MEMBER_ROLE | MEMBER_VERSION | MEMBER_COMMUNICATION_STACK | +---------------------------+--------------------------------------+----------------+-------------+--------------+-------------+----------------+----------------------------+ | group_replication_applier | 05c27710-1843-11ef-80a9-00505621b833 | 192.*.*.12 | 3306 | ONLINE | SECONDARY | 8.4.9 | MySQL | | group_replication_applier | 122d7061-1843-11ef-8ddb-005056286a23 | 192.*.*.10 | 3306 | ONLINE | PRIMARY | 8.4.9 | MySQL | | group_replication_applier | 141bfb53-1843-11ef-b4e7-005056393b43 | 192.*.*.11 | 3306 | ONLINE | SECONDARY | 8.4.9 | MySQL | +---------------------------+--------------------------------------+----------------+-------------+--------------+-------------+----------------+----------------------------+ [mysql@node1 data]$

至此,MySQL InnoDB Cluster 从 8.0.44 成功升级到了8.4.9版本。
升级后,如果dbeaver连接8.4.9报错,请参考文章:
DBeaver 连接 MySQL 8.4.9 报错:Public Key Retrieval is not allowed 解决

六、总结

本次版本升级过程整体平稳顺畅。升级前置两项核心工作必不可少:一是完成全量数据库备份,确保数据可回滚;二是严格开展MySQL 8.4.9 版本兼容性预检。
生产环境场景复杂多样,常存在各类适配问题,例如:配置项中包含 8.4 版本已废弃的系统参数、数据库账号仍沿用mysql_native_password旧认证插件、业务 SQL/业务表 占用新版本保留关键字等。各类兼容问题需提前排查、逐项梳理,做好业务的全功能测试,做到具体场景具体分析,逐一适配整改后再进行正式升级。

七、关于作者

网名:飞天,墨天轮2024年度、2025年度优秀原创作者,拥有 Oracle 10g OCM 认证、PGCE认证、MySQL 8.0 OCP认证以及OBCA、KCP、KCSM、ACP、YCP、HCIP-openGauss、HCCDP-GaussDB、磐维等众多国产数据库认证证书,目前从事Oracle、Mysql、PostgreSQL、磐维数据库管理运维工作,喜欢结交更多志同道合的朋友,热衷于研究、分享数据库技术。
微信公众号:飞天online
墨天轮:https://www.modb.pro/u/15197
如有任何疑问,欢迎大家留言,共同探讨~~~

最后修改时间:2026-05-13 09:35:04
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

文章被以下合辑收录

评论