MySQL MGR集群通过YUM小版本升级从8.0.25滚动升级到8.0.33

线上MGR集群4节点服务已配置,运行的版本是8.0.25,现在将线上4台服务器实例滚动升级到8.0.33版本
配置过程如下:
查看现在的集群情况:
mysql>  select * from performance_schema.replication_group_members;
+---------------------------+--------------------------------------+-------------+-------------+--------------+-------------+----------------+
| CHANNEL_NAME              | MEMBER_ID                            | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE | MEMBER_ROLE | MEMBER_VERSION |
+---------------------------+--------------------------------------+-------------+-------------+--------------+-------------+----------------+
| group_replication_applier | 3f0b970b-26e6-11ee-a500-000c2998777e | mgr-node113 |        3306 | ONLINE       | SECONDARY   | 8.0.25         |
| group_replication_applier | 7bebbd0c-ff03-11eb-a498-000c295704d3 | mgr-node110 |        3306 | ONLINE       | PRIMARY     | 8.0.25         |
| group_replication_applier | b319a91f-ff03-11eb-a368-000c29ddd76a | mgr-node111 |        3306 | ONLINE       | SECONDARY   | 8.0.25         |
| group_replication_applier | dd2f6b3f-ff03-11eb-8873-000c296c5a4d | mgr-node112 |        3306 | ONLINE       | SECONDARY   | 8.0.25         |
+---------------------------+--------------------------------------+-------------+-------------+--------------+-------------+----------------+
4 rows in set (0.00 sec)
线上环境为单主环境,一主三从
先升级从库:mgr-node113(172.16.1.113)
设置 关闭数据库为 slow 的方式:
mysql> set global innodb_fast_shutdown = 0;
Query OK, 0 rows affected (0.00 sec)
配置成参数0的原因是因为要干净的关闭服务:

在mysql关闭时,参数innodb_fast_shutdown 影响着表的存储引擎为innodb的行为。参数为0,1,2三个值。

0,代表当MYSQL关闭时,Innodb需要完成所有full purge和merge insert buffer操作,这需要花费时间来完成。如果做Innodb plugin升级,通常需要将这个参数调为0,,然后在关闭数据库
1, 是参数的默认值,不需要完成full purge和merge insert buffer操作,但是在缓冲池的一些数据脏页还是会刷新到磁盘。
2   表示 不需要完成full purge和merge insert buffer操作 ,也不将缓冲池中的数据脏页写回磁盘,。而是将日志都写入日志文件。这样不会有任何事物丢失,但是mysql在下次启动时,会执行恢复操作(recovery)

如果在上次关闭innodb的时候是在innodb_fast_shutdown=2或是mysql crash这种情况,那么它会利用redo log重做那些已经提交了的事务。
接下来的操作过程是:
(1). Rollback uncompleted transitions 取消那些没有提交的事务
(2). Purge all 清除无用的undo页
(3). Merge insert buffer 合并插入缓冲

关闭数据库
mysql> select @@innodb_fast_shutdown;
+------------------------+
| @@innodb_fast_shutdown |
+------------------------+
|                      0 |
+------------------------+
1 row in set (0.00 sec)
mysql> shutdown;
Query OK, 0 rows affected (0.00 sec)
停止组复制
mysql>stop group_replication;

上传8.0.33版本的所有YUM文件:
[root@mgr-node113 mysql_install_8.0.33]# ll
总用量 93056
-rw-r--r-- 1 root root 16972740 3月  17 17:28 mysql-community-client-8.0.33-1.el7.x86_64.rpm
-rw-r--r-- 1 root root  3746004 3月  17 17:28 mysql-community-client-plugins-8.0.33-1.el7.x86_64.rpm
-rw-r--r-- 1 root root   680276 3月  17 17:28 mysql-community-common-8.0.33-1.el7.x86_64.rpm
-rw-r--r-- 1 root root  1969188 3月  17 17:29 mysql-community-devel-8.0.33-1.el7.x86_64.rpm
-rw-r--r-- 1 root root  2219168 3月  17 17:29 mysql-community-icu-data-files-8.0.33-1.el7.x86_64.rpm
-rw-r--r-- 1 root root  1587536 3月  17 17:29 mysql-community-libs-8.0.33-1.el7.x86_64.rpm
-rw-r--r-- 1 root root   686272 3月  17 17:29 mysql-community-libs-compat-8.0.33-1.el7.x86_64.rpm
-rw-r--r-- 1 root root 67412732 3月  17 17:30 mysql-community-server-8.0.33-1.el7.x86_64.rpm

通过yum执行本地安装:
[root@mgr-node113 mysql_install_8.0.33]# yum localinstall ./*
已加载插件:fastestmirror
正在检查 ./mysql-community-client-8.0.33-1.el7.x86_64.rpm: mysql-community-client-8.0.33-1.el7.x86_64
./mysql-community-client-8.0.33-1.el7.x86_64.rpm 将作为 mysql-community-client-8.0.25-1.el7.x86_64 的更新
正在检查 ./mysql-community-client-plugins-8.0.33-1.el7.x86_64.rpm: mysql-community-client-plugins-8.0.33-1.el7.x86_64
./mysql-community-client-plugins-8.0.33-1.el7.x86_64.rpm 将作为 mysql-community-client-plugins-8.0.25-1.el7.x86_64 的更新
正在检查 ./mysql-community-common-8.0.33-1.el7.x86_64.rpm: mysql-community-common-8.0.33-1.el7.x86_64
./mysql-community-common-8.0.33-1.el7.x86_64.rpm 将作为 mysql-community-common-8.0.25-1.el7.x86_64 的更新
正在检查 ./mysql-community-devel-8.0.33-1.el7.x86_64.rpm: mysql-community-devel-8.0.33-1.el7.x86_64
./mysql-community-devel-8.0.33-1.el7.x86_64.rpm 将作为 mysql-community-devel-8.0.25-1.el7.x86_64 的更新
正在检查 ./mysql-community-icu-data-files-8.0.33-1.el7.x86_64.rpm: mysql-community-icu-data-files-8.0.33-1.el7.x86_64
./mysql-community-icu-data-files-8.0.33-1.el7.x86_64.rpm 将被安装
正在检查 ./mysql-community-libs-8.0.33-1.el7.x86_64.rpm: mysql-community-libs-8.0.33-1.el7.x86_64
./mysql-community-libs-8.0.33-1.el7.x86_64.rpm 将作为 mysql-community-libs-8.0.25-1.el7.x86_64 的更新
正在检查 ./mysql-community-libs-compat-8.0.33-1.el7.x86_64.rpm: mysql-community-libs-compat-8.0.33-1.el7.x86_64
./mysql-community-libs-compat-8.0.33-1.el7.x86_64.rpm 将作为 mysql-community-libs-compat-8.0.25-1.el7.x86_64 的更新
正在检查 ./mysql-community-server-8.0.33-1.el7.x86_64.rpm: mysql-community-server-8.0.33-1.el7.x86_64
./mysql-community-server-8.0.33-1.el7.x86_64.rpm 将作为 mysql-community-server-8.0.25-1.el7.x86_64 的更新
正在解决依赖关系
--> 正在检查事务
---> 软件包 mysql-community-client.x86_64.0.8.0.25-1.el7 将被 升级
---> 软件包 mysql-community-client.x86_64.0.8.0.33-1.el7 将被 更新
---> 软件包 mysql-community-client-plugins.x86_64.0.8.0.25-1.el7 将被 升级
---> 软件包 mysql-community-client-plugins.x86_64.0.8.0.33-1.el7 将被 更新
---> 软件包 mysql-community-common.x86_64.0.8.0.25-1.el7 将被 升级
---> 软件包 mysql-community-common.x86_64.0.8.0.33-1.el7 将被 更新
---> 软件包 mysql-community-devel.x86_64.0.8.0.25-1.el7 将被 升级
---> 软件包 mysql-community-devel.x86_64.0.8.0.33-1.el7 将被 更新
---> 软件包 mysql-community-icu-data-files.x86_64.0.8.0.33-1.el7 将被 安装
---> 软件包 mysql-community-libs.x86_64.0.8.0.25-1.el7 将被 升级
---> 软件包 mysql-community-libs.x86_64.0.8.0.33-1.el7 将被 更新
---> 软件包 mysql-community-libs-compat.x86_64.0.8.0.25-1.el7 将被 升级
---> 软件包 mysql-community-libs-compat.x86_64.0.8.0.33-1.el7 将被 更新
---> 软件包 mysql-community-server.x86_64.0.8.0.25-1.el7 将被 升级
---> 软件包 mysql-community-server.x86_64.0.8.0.33-1.el7 将被 更新
--> 解决依赖关系完成
依赖关系解决
=========================================================================================================================
Package                          架构     版本              源                                                     大小
=========================================================================================================================
正在安装:
mysql-community-icu-data-files   x86_64   8.0.33-1.el7      /mysql-community-icu-data-files-8.0.33-1.el7.x86_64   3.5 M
正在更新:
mysql-community-client           x86_64   8.0.33-1.el7      /mysql-community-client-8.0.33-1.el7.x86_64            80 M
mysql-community-client-plugins   x86_64   8.0.33-1.el7      /mysql-community-client-plugins-8.0.33-1.el7.x86_64    20 M
mysql-community-common           x86_64   8.0.33-1.el7      /mysql-community-common-8.0.33-1.el7.x86_64            10 M
mysql-community-devel            x86_64   8.0.33-1.el7      /mysql-community-devel-8.0.33-1.el7.x86_64             10 M
mysql-community-libs             x86_64   8.0.33-1.el7      /mysql-community-libs-8.0.33-1.el7.x86_64             7.6 M
mysql-community-libs-compat      x86_64   8.0.33-1.el7      /mysql-community-libs-compat-8.0.33-1.el7.x86_64      3.7 M
mysql-community-server           x86_64   8.0.33-1.el7      /mysql-community-server-8.0.33-1.el7.x86_64           295 M


事务概要
=========================================================================================================================
安装  1 软件包
升级  7 软件包


总计:430 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在更新    : mysql-community-client-plugins-8.0.33-1.el7.x86_64                                                  1/15
  正在更新    : mysql-community-common-8.0.33-1.el7.x86_64                                                          2/15
  正在更新    : mysql-community-libs-8.0.33-1.el7.x86_64                                                            3/15
  正在更新    : mysql-community-client-8.0.33-1.el7.x86_64                                                          4/15
  正在安装    : mysql-community-icu-data-files-8.0.33-1.el7.x86_64                                                  5/15
  正在更新    : mysql-community-server-8.0.33-1.el7.x86_64                                                          6/15
  正在更新    : mysql-community-libs-compat-8.0.33-1.el7.x86_64                                                     7/15
  正在更新    : mysql-community-devel-8.0.33-1.el7.x86_64                                                           8/15
  清理        : mysql-community-server-8.0.25-1.el7.x86_64                                                          9/15
  清理        : mysql-community-devel-8.0.25-1.el7.x86_64                                                          10/15
  清理        : mysql-community-client-8.0.25-1.el7.x86_64                                                         11/15
  清理        : mysql-community-libs-compat-8.0.25-1.el7.x86_64                                                    12/15
  清理        : mysql-community-libs-8.0.25-1.el7.x86_64                                                           13/15
  清理        : mysql-community-common-8.0.25-1.el7.x86_64                                                         14/15
  清理        : mysql-community-client-plugins-8.0.25-1.el7.x86_64                                                 15/15
  验证中      : mysql-community-common-8.0.33-1.el7.x86_64                                                          1/15
  验证中      : mysql-community-libs-compat-8.0.33-1.el7.x86_64                                                     2/15
  验证中      : mysql-community-client-plugins-8.0.33-1.el7.x86_64                                                  3/15
  验证中      : mysql-community-libs-8.0.33-1.el7.x86_64                                                            4/15
  验证中      : mysql-community-server-8.0.33-1.el7.x86_64                                                          5/15
  验证中      : mysql-community-icu-data-files-8.0.33-1.el7.x86_64                                                  6/15
  验证中      : mysql-community-client-8.0.33-1.el7.x86_64                                                          7/15
  验证中      : mysql-community-devel-8.0.33-1.el7.x86_64                                                           8/15
  验证中      : mysql-community-libs-compat-8.0.25-1.el7.x86_64                                                     9/15
  验证中      : mysql-community-common-8.0.25-1.el7.x86_64                                                         10/15
  验证中      : mysql-community-client-plugins-8.0.25-1.el7.x86_64                                                 11/15
  验证中      : mysql-community-devel-8.0.25-1.el7.x86_64                                                          12/15
  验证中      : mysql-community-server-8.0.25-1.el7.x86_64                                                         13/15
  验证中      : mysql-community-client-8.0.25-1.el7.x86_64                                                         14/15
  验证中      : mysql-community-libs-8.0.25-1.el7.x86_64                                                           15/15

已安装:
  mysql-community-icu-data-files.x86_64 0:8.0.33-1.el7                                                                  

更新完毕:
  mysql-community-client.x86_64 0:8.0.33-1.el7            mysql-community-client-plugins.x86_64 0:8.0.33-1.el7          
  mysql-community-common.x86_64 0:8.0.33-1.el7            mysql-community-devel.x86_64 0:8.0.33-1.el7                   
  mysql-community-libs.x86_64 0:8.0.33-1.el7              mysql-community-libs-compat.x86_64 0:8.0.33-1.el7             
  mysql-community-server.x86_64 0:8.0.33-1.el7       
  
安装完成后,可以直接启动数据库,数据库会自动运行mysql_upgrade进行数据库升级
官方方档解释如下:
The MySQL server always restarts after an update by Yum. Prior to MySQL 8.0.16, run
mysql_upgradeafter the server restarts to check and possibly resolve any incompatibilities
between the old data and the upgraded software. mysql_upgradealso performs other functions;
for details, see Section 4.4.5, “mysql_upgrade — Check and Upgrade MySQL Tables”. As of
MySQL 8.0.16, this step is not required, as the server performs all tasks previously handled by
mysql_upgrade.
启动数据库:
systemctl start mysqld


数据库错误日志如下:
[root@mgr-node113 ~]# cat /var/log/mysqld.log 
2023-07-22T07:58:39.442695Z 0 [Warning] [MY-011069] [Server] The syntax '--master-info-repository' is deprecated and will be removed in a future release.
2023-07-22T07:58:39.442726Z 0 [Warning] [MY-011069] [Server] The syntax '--relay-log-info-repository' is deprecated and will be removed in a future release.
2023-07-22T07:58:39.442761Z 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.
2023-07-22T07:58:39.442790Z 0 [Warning] [MY-011068] [Server] The syntax 'sync_master_info' is deprecated and will be removed in a future release. Please use sync_source_info instead.
2023-07-22T07:58:39.442822Z 0 [Warning] [MY-011068] [Server] The syntax 'skip_slave_start' is deprecated and will be removed in a future release. Please use skip_replica_start instead.
2023-07-22T07:58:39.442838Z 0 [Warning] [MY-011069] [Server] The syntax '--transaction-write-set-extraction' is deprecated and will be removed in a future release.
2023-07-22T07:58:39.445061Z 0 [Warning] [MY-010918] [Server] 'default_authentication_plugin' is deprecated and will be removed in a future release. Please use authentication_policy instead.
2023-07-22T07:58:39.445073Z 0 [Note] [MY-013932] [Server] BuildID[sha1]=0d441faec2944aba473cbc69eb61e27c4074d942
2023-07-22T07:58:39.445083Z 0 [Note] [MY-010949] [Server] Basedir set to /usr/.
2023-07-22T07:58:39.445110Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.33) starting as process 6382
2023-07-22T07:58:39.467864Z 0 [Note] [MY-012366] [InnoDB] Using Linux native AIO
2023-07-22T07:58:39.468774Z 0 [Note] [MY-010747] [Server] Plugin 'FEDERATED' is disabled.
2023-07-22T07:58:39.469069Z 0 [Note] [MY-010747] [Server] Plugin 'ndbcluster' is disabled.
2023-07-22T07:58:39.469213Z 0 [Note] [MY-010747] [Server] Plugin 'ndbinfo' is disabled.
2023-07-22T07:58:39.469270Z 0 [Note] [MY-010747] [Server] Plugin 'ndb_transid_mysql_connection_map' is disabled.
2023-07-22T07:58:39.472917Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-07-22T07:58:39.473039Z 1 [Note] [MY-013546] [InnoDB] Atomic write enabled
2023-07-22T07:58:39.473132Z 1 [Note] [MY-012932] [InnoDB] PUNCH HOLE support available
2023-07-22T07:58:39.473275Z 1 [Note] [MY-012944] [InnoDB] Uses event mutexes
2023-07-22T07:58:39.473314Z 1 [Note] [MY-012945] [InnoDB] GCC builtin __atomic_thread_fence() is used for memory barrier
2023-07-22T07:58:39.473360Z 1 [Note] [MY-012948] [InnoDB] Compressed tables use zlib 1.2.13
2023-07-22T07:58:39.480794Z 1 [Note] [MY-012951] [InnoDB] Using hardware accelerated crc32 and polynomial multiplication.
2023-07-22T07:58:39.482622Z 1 [Note] [MY-012203] [InnoDB] Directories to scan './'
2023-07-22T07:58:39.482974Z 1 [Note] [MY-012204] [InnoDB] Scanning './'
2023-07-22T07:58:39.497609Z 1 [Note] [MY-012208] [InnoDB] Completed space ID check of 7 files.
2023-07-22T07:58:39.499455Z 1 [Note] [MY-012955] [InnoDB] Initializing buffer pool, total size = 128.000000M, instances = 1, chunk size =128.000000M
2023-07-22T07:58:39.521973Z 1 [Note] [MY-012957] [InnoDB] Completed initialization of buffer pool
2023-07-22T07:58:39.529583Z 0 [Note] [MY-011952] [InnoDB] If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2023-07-22T07:58:39.531717Z 1 [Note] [MY-013532] [InnoDB] Using './#ib_16384_0.dblwr' for doublewrite
2023-07-22T07:58:39.532988Z 1 [Note] [MY-013532] [InnoDB] Using './#ib_16384_1.dblwr' for doublewrite
2023-07-22T07:58:39.612081Z 1 [Note] [MY-013566] [InnoDB] Double write buffer files: 2
2023-07-22T07:58:39.612235Z 1 [Note] [MY-013565] [InnoDB] Double write buffer pages per instance: 4
2023-07-22T07:58:39.612343Z 1 [Note] [MY-013532] [InnoDB] Using './#ib_16384_0.dblwr' for doublewrite
2023-07-22T07:58:39.612504Z 1 [Note] [MY-013532] [InnoDB] Using './#ib_16384_1.dblwr' for doublewrite
2023-07-22T07:58:39.698600Z 1 [Note] [MY-012529] [InnoDB] Redo log format is v4. The redo log was created before MySQL 8.0.30.
2023-07-22T07:58:39.700789Z 1 [Note] [MY-012557] [InnoDB] Redo log is from an earlier version, v4.
2023-07-22T07:58:39.701075Z 1 [Note] [MY-013888] [InnoDB] Upgrading redo log: 0M, LSN=19385886.
2023-07-22T07:58:39.701111Z 1 [Note] [MY-012968] [InnoDB] Starting to delete and rewrite redo log files.
2023-07-22T07:58:39.764986Z 1 [Note] [MY-012893] [InnoDB] New redo log files created, LSN=19386380
2023-07-22T07:58:39.765251Z 1 [Note] [MY-013883] [InnoDB] The latest found checkpoint is at lsn = 19386380 in redo log file ./#innodb_redo/#ib_redo0.
2023-07-22T07:58:39.765489Z 1 [Note] [MY-013086] [InnoDB] Starting to parse redo log at lsn = 19386380, whereas checkpoint_lsn = 19386380 and start_lsn = 19386368
2023-07-22T07:58:39.775321Z 1 [Note] [MY-013083] [InnoDB] Log background threads are being started...
2023-07-22T07:58:39.777693Z 1 [Note] [MY-012532] [InnoDB] Applying a batch of 0 redo log records ...
2023-07-22T07:58:39.777906Z 1 [Note] [MY-012535] [InnoDB] Apply batch completed!
2023-07-22T07:58:39.778803Z 1 [Note] [MY-013252] [InnoDB] Using undo tablespace './undo_001'.
2023-07-22T07:58:39.781657Z 1 [Note] [MY-013252] [InnoDB] Using undo tablespace './undo_002'.
2023-07-22T07:58:39.791364Z 1 [Note] [MY-012910] [InnoDB] Opened 2 existing undo tablespaces.
2023-07-22T07:58:39.791557Z 1 [Note] [MY-011980] [InnoDB] GTID recovery trx_no: 10395
2023-07-22T07:58:40.101430Z 1 [Note] [MY-013776] [InnoDB] Parallel initialization of rseg complete
2023-07-22T07:58:40.101558Z 1 [Note] [MY-013777] [InnoDB] Time taken to initialize rseg using 4 thread: 310010 ms.
2023-07-22T07:58:40.101967Z 1 [Note] [MY-012923] [InnoDB] Creating shared tablespace for temporary tables
2023-07-22T07:58:40.102124Z 1 [Note] [MY-012265] [InnoDB] Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2023-07-22T07:58:40.145418Z 1 [Note] [MY-012266] [InnoDB] File './ibtmp1' size is now 12 MB.
2023-07-22T07:58:40.145905Z 1 [Note] [MY-013627] [InnoDB] Scanning temp tablespace dir:'./#innodb_temp/'
2023-07-22T07:58:40.170134Z 1 [Note] [MY-013018] [InnoDB] Created 128 and tracked 128 new rollback segment(s) in the temporary tablespace. 128 are now active.
2023-07-22T07:58:40.170921Z 1 [Note] [MY-012976] [InnoDB] 8.0.33 started; log sequence number 19386390
2023-07-22T07:58:40.175143Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2023-07-22T07:58:40.202630Z 1 [Note] [MY-013327] [Server] MySQL server upgrading from version '80025' to '80033'.
2023-07-22T07:58:40.454932Z 1 [Note] [MY-012357] [InnoDB] Reading DD tablespace files
2023-07-22T07:58:40.462074Z 1 [Note] [MY-012356] [InnoDB] Scanned 9 tablespaces. Validated 9.
2023-07-22T07:58:41.008483Z 1 [Note] [MY-010006] [Server] Using data dictionary with version '80023'.
2023-07-22T07:58:41.097633Z 0 [Note] [MY-011332] [Server] Plugin mysqlx reported: 'IPv6 is available'
2023-07-22T07:58:41.098737Z 0 [Note] [MY-011323] [Server] Plugin mysqlx reported: 'X Plugin ready for connections. bind-address: '::' port: 33060'
2023-07-22T07:58:41.107522Z 0 [Note] [MY-011323] [Server] Plugin mysqlx reported: 'X Plugin ready for connections. socket: '/var/run/mysqld/mysqlx.sock''
2023-07-22T07:58:44.766423Z 6 [System] [MY-013381] [Server] Server upgrade from '80025' to '80033' started.
2023-07-22T07:58:44.769478Z 6 [Note] [MY-013386] [Server] Running queries to upgrade MySQL server.
2023-07-22T07:58:50.188440Z 6 [Note] [MY-013387] [Server] Upgrading system table data.
2023-07-22T07:58:53.201069Z 6 [Note] [MY-013385] [Server] Upgrading the sys schema.
2023-07-22T07:58:55.209057Z 6 [Note] [MY-013400] [Server] Upgrade of help tables started.
2023-07-22T07:58:55.793669Z 6 [Note] [MY-013400] [Server] Upgrade of help tables completed.
2023-07-22T07:58:55.794013Z 6 [Note] [MY-013394] [Server] Checking 'mysql' schema.
2023-07-22T07:58:55.949230Z 6 [Note] [MY-013394] [Server] Checking 'sys' schema.
2023-07-22T07:58:56.002839Z 6 [System] [MY-013381] [Server] Server upgrade from '80025' to '80033' completed.
2023-07-22T07:58:56.072449Z 0 [Note] [MY-010902] [Server] Thread priority attribute setting in Resource Group SQL shall be ignored due to unsupported platform or insufficient privilege.
2023-07-22T07:58:56.080500Z 0 [Note] [MY-010856] [Server] Failed to open the crashed binlog file when source server is recovering it.
2023-07-22T07:58:56.125668Z 0 [Note] [MY-013911] [Server] Crash recovery finished in binlog engine. No attempts to commit, rollback or prepare any transactions.
2023-07-22T07:58:56.125813Z 0 [Note] [MY-013911] [Server] Crash recovery finished in InnoDB engine. No attempts to commit, rollback or prepare any transactions.
2023-07-22T07:58:56.141834Z 0 [Note] [MY-012487] [InnoDB] DDL log recovery : begin
2023-07-22T07:58:56.142400Z 0 [Note] [MY-012488] [InnoDB] DDL log recovery : end
2023-07-22T07:58:56.143951Z 0 [Note] [MY-011946] [InnoDB] Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2023-07-22T07:58:56.146292Z 0 [Note] [MY-011946] [InnoDB] Buffer pool(s) load completed at 230722 15:58:56
2023-07-22T07:58:56.184939Z 0 [Note] [MY-010182] [Server] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2023-07-22T07:58:56.185034Z 0 [Note] [MY-010304] [Server] Skipping generation of SSL certificates as certificate files are present in data directory.
2023-07-22T07:58:56.189367Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2023-07-22T07:58:56.189685Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2023-07-22T07:58:56.189953Z 0 [Note] [MY-010308] [Server] Skipping generation of RSA key pair through --sha256_password_auto_generate_rsa_keys as key files are present in data directory.
2023-07-22T07:58:56.190155Z 0 [Note] [MY-010308] [Server] Skipping generation of RSA key pair through --caching_sha2_password_auto_generate_rsa_keys as key files are present in data directory.
2023-07-22T07:58:56.192520Z 0 [Note] [MY-010252] [Server] Server hostname (bind-address): '*'; port: 3306
2023-07-22T07:58:56.192774Z 0 [Note] [MY-010253] [Server] IPv6 is available.
2023-07-22T07:58:56.192870Z 0 [Note] [MY-010264] [Server]   - '::' resolves to '::';
2023-07-22T07:58:56.192927Z 0 [Note] [MY-010251] [Server] Server socket created on IP: '::'.
2023-07-22T07:58:56.242490Z 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=mgr-node113-relay-bin' to avoid this problem.
2023-07-22T07:58:56.271253Z 9 [Note] [MY-010051] [Server] Event Scheduler: scheduler thread started with id 9
2023-07-22T07:58:56.272547Z 0 [Note] [MY-011240] [Server] Plugin mysqlx reported: 'Using SSL configuration from MySQL Server'
2023-07-22T07:58:56.284702Z 0 [Note] [MY-011243] [Server] Plugin mysqlx reported: 'Using OpenSSL for TLS connections'
2023-07-22T07:58:56.285362Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
2023-07-22T07:58:56.285517Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.33'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server - GPL.


启动服务器,可以直接开启组复制:
change master to master_user='rpl_slave',master_password='sef@1234@1' for channel 'group_replication_recovery';
start group_replication;  


组复制启动后,查看组成员情况:
mysql>  select * from performance_schema.replication_group_members;
+---------------------------+--------------------------------------+-------------+-------------+--------------+-------------+----------------+
| CHANNEL_NAME              | MEMBER_ID                            | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE | MEMBER_ROLE | MEMBER_VERSION |
+---------------------------+--------------------------------------+-------------+-------------+--------------+-------------+----------------+
| group_replication_applier | 3f0b970b-26e6-11ee-a500-000c2998777e | mgr-node113 |        3306 | ONLINE       | SECONDARY   | 8.0.33         |
| group_replication_applier | 7bebbd0c-ff03-11eb-a498-000c295704d3 | mgr-node110 |        3306 | ONLINE       | PRIMARY     | 8.0.25         |
| group_replication_applier | b319a91f-ff03-11eb-a368-000c29ddd76a | mgr-node111 |        3306 | ONLINE       | SECONDARY   | 8.0.25         |
| group_replication_applier | dd2f6b3f-ff03-11eb-8873-000c296c5a4d | mgr-node112 |        3306 | ONLINE       | SECONDARY   | 8.0.25         |
+---------------------------+--------------------------------------+-------------+-------------+--------------+-------------+----------------+

从上面可以看到 mgr-node113节点已升级到8.0.33版本,其它的实例还是8.0.25版本

其它SECONDARY节点升级跟ngr-node113一样,按上面的步骤操作就可以了

当所有SECONDARY节点都升级完成后的组成员情况如下:
mysql>  select * from performance_schema.replication_group_members;
+---------------------------+--------------------------------------+-------------+-------------+--------------+-------------+----------------+
| CHANNEL_NAME              | MEMBER_ID                            | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE | MEMBER_ROLE | MEMBER_VERSION |
+---------------------------+--------------------------------------+-------------+-------------+--------------+-------------+----------------+
| group_replication_applier | 3f0b970b-26e6-11ee-a500-000c2998777e | mgr-node113 |        3306 | ONLINE       | SECONDARY   | 8.0.33         |
| group_replication_applier | 7bebbd0c-ff03-11eb-a498-000c295704d3 | mgr-node110 |        3306 | ONLINE       | PRIMARY     | 8.0.25         |
| group_replication_applier | b319a91f-ff03-11eb-a368-000c29ddd76a | mgr-node111 |        3306 | ONLINE       | SECONDARY   | 8.0.33         |
| group_replication_applier | dd2f6b3f-ff03-11eb-8873-000c296c5a4d | mgr-node112 |        3306 | ONLINE       | SECONDARY   | 8.0.33         |
+---------------------------+--------------------------------------+-------------+-------------+--------------+-------------+----------------+
4 rows in set (0.00 sec)
现在只有主节点没有升级,其它SECONDARY节点已全部升级完成

主节点的升级:
手动将主节点切换到其它节点,比如mgr-node111节点
# 指定member_id作为主库
select group_replication_set_as_primary('b319a91f-ff03-11eb-a368-000c29ddd76a') ; 
报如下错误:
mysql> select group_replication_set_as_primary('dd2f6b3f-ff03-11eb-8873-000c296c5a4d');
ERROR 3910 (HY000): The function 'group_replication_set_as_primary' failed. Error processing configuration start message: The appointed primary member has a version that is greater than the one of some of the members in the group.

没有办法,先将集群切换到多主模式:
mysql> select group_replication_switch_to_multi_primary_mode();
+--------------------------------------------------+
| group_replication_switch_to_multi_primary_mode() |
+--------------------------------------------------+
| Mode switched to multi-primary successfully.     |
+--------------------------------------------------+
1 row in set (0.18 sec)
查看组成员情况:
mysql>  select * from performance_schema.replication_group_members;
+---------------------------+--------------------------------------+-------------+-------------+--------------+-------------+----------------+
| CHANNEL_NAME              | MEMBER_ID                            | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE | MEMBER_ROLE | MEMBER_VERSION |
+---------------------------+--------------------------------------+-------------+-------------+--------------+-------------+----------------+
| group_replication_applier | 3f0b970b-26e6-11ee-a500-000c2998777e | mgr-node113 |        3306 | ONLINE       | PRIMARY     | 8.0.33         |
| group_replication_applier | 7bebbd0c-ff03-11eb-a498-000c295704d3 | mgr-node110 |        3306 | ONLINE       | PRIMARY     | 8.0.25         |
| group_replication_applier | b319a91f-ff03-11eb-a368-000c29ddd76a | mgr-node111 |        3306 | ONLINE       | PRIMARY     | 8.0.33         |
| group_replication_applier | dd2f6b3f-ff03-11eb-8873-000c296c5a4d | mgr-node112 |        3306 | ONLINE       | PRIMARY     | 8.0.33         |
+---------------------------+--------------------------------------+-------------+-------------+--------------+-------------+----------------+
4 rows in set (0.00 sec)


将原来的主成员下线进行升级:
登录mgr-node110实例,停止组复制:
mysql> stop group_replication;\


配置innodb_fast_shutdown参数:
mysql> set global innodb_fast_shutdown=0;
Query OK, 0 rows affected (0.01 sec)


关闭实例:
mysql>shutdown;


升级mgr-node110实例:
[root@mgr-node110 mysql_install_8.0.33]# ls
mysql-community-client-8.0.33-1.el7.x86_64.rpm          mysql-community-libs-8.0.33-1.el7.x86_64.rpm
mysql-community-client-plugins-8.0.33-1.el7.x86_64.rpm  mysql-community-libs-compat-8.0.33-1.el7.x86_64.rpm
mysql-community-common-8.0.33-1.el7.x86_64.rpm          mysql-community-server-8.0.33-1.el7.x86_64.rpm
mysql-community-devel-8.0.33-1.el7.x86_64.rpm           mysql-community-server-debug-8.0.33-1.el7.x86_64.rpm
mysql-community-icu-data-files-8.0.33-1.el7.x86_64.rpm
[root@mgr-node110 mysql_install_8.0.33]# yum localinstall ./*
需要通过以下的方式来将主节点进行升级:
启动实例:
[root@mgr-node110 mysql_install_8.0.33]# systemctl start mysqld
mysql>reset master;
重新加入到集群:
复制以下参数:
vim /etc/my.cnf
loose-group_replication_single_primary_mode=off
loose-group_replication_enforce_update_everywhere_checks=on
重启服务:
[root@mgr-node110 mysql_install_8.0.33]# systemctl restart mysqld
配置组复制:
mysql> change master to master_user='rpl_slave',master_password='sef@1234@1' for channel 'group_replication_recovery';
mysql> start group_replication;
mgr-node110 节点会自动同步,实例会重新启动
实例重新启动后,就开启组复制就可以了
mysql> change master to master_user='rpl_slave',master_password='sef@1234@1' for channel 'group_replication_recovery';
mysql> start group_replication;
 
查看集群成员清单:
mysql> select * from performance_schema.replication_group_members;
+---------------------------+--------------------------------------+-------------+-------------+--------------+-------------+----------------+----------------------------+
| CHANNEL_NAME              | MEMBER_ID                            | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE | MEMBER_ROLE | MEMBER_VERSION | MEMBER_COMMUNICATION_STACK |
+---------------------------+--------------------------------------+-------------+-------------+--------------+-------------+----------------+----------------------------+
| group_replication_applier | 3f0b970b-26e6-11ee-a500-000c2998777e | mgr-node113 |        3306 | ONLINE       | PRIMARY     | 8.0.33         | XCom                       |
| group_replication_applier | 7bebbd0c-ff03-11eb-a498-000c295704d3 | mgr-node110 |        3306 | ONLINE       | PRIMARY     | 8.0.33         | XCom                       |
| group_replication_applier | b319a91f-ff03-11eb-a368-000c29ddd76a | mgr-node111 |        3306 | ONLINE       | PRIMARY     | 8.0.33         | XCom                       |
| group_replication_applier | dd2f6b3f-ff03-11eb-8873-000c296c5a4d | mgr-node112 |        3306 | ONLINE       | PRIMARY     | 8.0.33         | XCom                       |
+---------------------------+--------------------------------------+-------------+-------------+--------------+-------------+----------------+----------------------------+
4 rows in set (0.00 sec)


将多主集群切换成单主集群:
mysql> select group_replication_switch_to_single_primary_mode("7bebbd0c-ff03-11eb-a498-000c295704d3");
+-----------------------------------------------------------------------------------------+
| group_replication_switch_to_single_primary_mode("7bebbd0c-ff03-11eb-a498-000c295704d3") |
+-----------------------------------------------------------------------------------------+
| Mode switched to single-primary successfully.                                           |
+-----------------------------------------------------------------------------------------+
1 row in set (0.43 sec)

查看组成员清单:
mysql> select * from performance_schema.replication_group_members;
+---------------------------+--------------------------------------+-------------+-------------+--------------+-------------+----------------+----------------------------+
| CHANNEL_NAME              | MEMBER_ID                            | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE | MEMBER_ROLE | MEMBER_VERSION | MEMBER_COMMUNICATION_STACK |
+---------------------------+--------------------------------------+-------------+-------------+--------------+-------------+----------------+----------------------------+
| group_replication_applier | 3f0b970b-26e6-11ee-a500-000c2998777e | mgr-node113 |        3306 | ONLINE       | SECONDARY   | 8.0.33         | XCom                       |
| group_replication_applier | 7bebbd0c-ff03-11eb-a498-000c295704d3 | mgr-node110 |        3306 | ONLINE       | PRIMARY     | 8.0.33         | XCom                       |
| group_replication_applier | b319a91f-ff03-11eb-a368-000c29ddd76a | mgr-node111 |        3306 | ONLINE       | SECONDARY   | 8.0.33         | XCom                       |
| group_replication_applier | dd2f6b3f-ff03-11eb-8873-000c296c5a4d | mgr-node112 |        3306 | ONLINE       | SECONDARY   | 8.0.33         | XCom                       |
+---------------------------+--------------------------------------+-------------+-------------+--------------+-------------+----------------+----------------------------+
4 rows in set (0.00 sec)

以上就完成了单主集群所有节点滚动升级的操作



分割线
感谢打赏
江西数库信息技术有限公司
YWSOS.COM 平台代运维解决方案
 评论
 发表评论
姓   名:

Powered by AKCMS