1. 背景和描述:
环境是一套7个节点的MySQL Innodb Cluster环境(multi-primary)。所有节点的操作系统都是RedHat Linux8.3(4.18.0-240.el8.x86_64 #1 SMP Wed Sep 23 05:13:10 EDT 2020 x86_64 x86_64 x86_64 GNU/Linux)。所有节点上安装的MySQL服务器版本都是8.0.36。示意图如下:
上述环境的MySQL Shell的版本是 8.0.21,需要升级MySQL Shell到8.0.36。也顺便需要升级MySQL Workben从8.0.21到8.0.36。
2. 升级MySQL Shell遇到的问题和处理方法:
node0-node6上的MySQL服务器的版本都是8.0.36,但是由于以下问题,MySQL Shell在RHEL8.3上只能安装到8.0.21版本:
[root@node0 innodb-cluster]# yum install mysql-shell-8.0.36-1.el8.x86_64.rpm Updating Subscription Management repositories. Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
上次元数据过期检查:0:52:47 前,执行于 2024年02月23日 星期五 20时55分55秒。 错误: 问题: conflicting requests - nothing provides libpython3.9.so.1.0()(64bit) needed by mysql-shell-8.0.36-1.el8.x86_64 (尝试添加 '--skip-broken' 来跳过无法安装的软件包 或 '--nobest' 来不只使用最佳选择的软件包)
|
libpython3.9.so.1.0这个依赖关系在RHEL8发行版本的iso文件中无法找到。需要通过centOS的https://vault.centos.org/8.5.2111/AppStream/x86_64/os/Packages/提供的一些rpm包来解决。为了方便读者,本文提供这些包的镜像供下载。具体包含三个包:1)python39-setuptools-wheel-50.3.2-4.module_el8.5.0 897 68c4c210.noarch.rpm;2)python39-pip-wheel-20.2.4-6.module_el8.5.0 897 68c4c210.noarch.rpm;3)python39-libs-3.9.6-2.module_el8.5.0 897 68c4c210.x86_64.rpm:
[root@node0 mysql-software]# rpm -ivh python39-setuptools-wheel-50.3.2-4.module_el8.5.0+897+68c4c210.noarch.rpm 警告:python39-setuptools-wheel-50.3.2-4.module_el8.5.0+897+68c4c210.noarch.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID 8483c65d: NOKEY Verifying... ################################# [100%] 准备中... ################################# [100%] 正在升级/安装... 1:python39-setuptools-wheel-50.3.2-################################# [100%] [root@node0 mysql-software]# rpm -ivh python39-pip-wheel-20.2.4-6.module_el8.5.0+897+68c4c210.noarch.rpm 警告:python39-pip-wheel-20.2.4-6.module_el8.5.0+897+68c4c210.noarch.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID 8483c65d: NOKEY Verifying... ################################# [100%] 准备中... ################################# [100%] 正在升级/安装... 1:python39-pip-wheel-20.2.4-6.modul################################# [100%] [root@node0 mysql-software]# rpm -ivh python39-libs-3.9.6-2.module_el8.5.0+897+68c4c210.x86_64.rpm 警告:python39-libs-3.9.6-2.module_el8.5.0+897+68c4c210.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID 8483c65d: NOKEY Verifying... ################################# [100%] 准备中... ################################# [100%] 正在升级/安装... 1:python39-libs-3.9.6-2.module_el8.################################# [100%]
|
之后,MySQL Shell 8.0.36在RHEL8上安装成功:
[root@node0 innodb-cluster]# yum install mysql-shell-8.0.36-1.el8.x86_64.rpm Updating Subscription Management repositories. Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
上次元数据过期检查:0:55:56 前,执行于 2024年02月23日 星期五 20时55分55秒。 依赖关系解决。 =================================================================================================== 软件包 架构 版本 仓库 大小 =================================================================================================== 升级: mysql-shell x86_64 8.0.36-1.el8 @commandline 29 M
事务概要 ===================================================================================================
总计:29 M 确定吗?[y/N]: y 下载软件包: 运行事务检查 事务检查成功。 运行事务测试 事务测试成功。 运行事务 准备中 : 1/1 升级 : mysql-shell-8.0.36-1.el8.x86_64 1/2 清理 : mysql-shell-8.0.21-1.el8.x86_64 2/2 运行脚本: mysql-shell-8.0.21-1.el8.x86_64 2/2 /sbin/ldconfig: /lib64/libk5crypto.so.3 不是符号链接
/sbin/ldconfig: /lib64/libk5crypto.so.3 不是符号链接
验证 : mysql-shell-8.0.36-1.el8.x86_64 1/2 验证 : mysql-shell-8.0.21-1.el8.x86_64 2/2 Installed products updated.
已升级: mysql-shell-8.0.36-1.el8.x86_64
完毕!
|
3. 升级mysqlsh后Innodb Cluster的metadata的升级过程:
在node0上使用mysqlsh连接MySQL Innodb Cluster:
[root@node0 mysql-software]# mysqlsh MySQL Shell 8.0.36
Copyright (c) 2016, 2023, 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 JS > \connect root@node0:3306 Creating a session to 'root@node0:3306' Please provide the password for 'root@node0:3306': ********* Save password for 'root@node0:3306'? [Y]es/[N]o/Ne[v]er (default No): Fetching schema names for auto-completion... Press ^C to stop. Your MySQL connection id is 23 Server version: 8.0.36 MySQL Community Server - GPL No default schema selected; type \use to set one.
|
使用dba.getCluster()获取MySQL Innodb Cluster的信息时,出错(MYSQLSH 51314)。这是因为当时创建Innodb Cluster时,使用的是MySQL Shell 8.0.21,导致集群的元数据版本为2.0.0。而现在,使用MySQL Shell 8.0.36连接集群,MySQL Shell包含的Admin API期望连接的是2.1.0的Innodb Cluster,所以需要升级元数据:
MySQL node0:3306 ssl JS > var cluster = dba.getCluster('testCluster'); NOTE:
The installed metadata version 2.0.0 is lower than the version required
by Shell which is version 2.1.0. It is recommended to upgrade the
metadata. See \? dba.upgradeMetadata for additional details. Dba.getCluster:
This function is not available through a session to a standalone
instance (metadata exists, instance belongs to that metadata, but GR is
not active) (MYSQLSH 51314)
|
必需在MySQL Shell 8.0.36中使用dba.upgradeMetatdata()升级MySQL Innodb Cluster。dba.upgradeMetadata()的用法说明如下:
MySQL node0:3306 ssl JS > \? dba.upgradeMetadata NAME upgradeMetadata - Upgrades (or restores) the metadata to the version supported by the Shell.
SYNTAX dba.upgradeMetadata([options])
WHERE options: Dictionary with option for the operation.
DESCRIPTION This function will compare the version of the installed metadata schema with the version of the metadata schema supported by this Shell. If the installed metadata version is lower, an upgrade process will be started.
The options dictionary accepts the following attributes:
- dryRun: boolean value used to enable a dry run of the upgrade process. - interactive: boolean value used to disable/enable the wizards in the command execution, i.e. prompts and confirmations will be provided or not according to the value set. The default value is equal to MySQL Shell wizard mode. Deprecated.
If dryRun is used, the function will determine whether a metadata upgrade or restore is required and inform the user without actually executing the operation.
The interactive option can be used to explicitly enable or disable the interactive prompts that help the user through te upgrade process. The default value is equal to MySQL Shell wizard mode.
The Upgrade Process
When upgrading the metadata schema of clusters deployed by Shell versions before 8.0.19, a rolling upgrade of existing MySQL Router instances is required. This process allows minimizing disruption to applications during the upgrade.
The rolling upgrade process must be performed in the following order:
1. Execute dba.upgradeMetadata() using the latest Shell version. The upgrade function will stop if outdated Router instances are detected, at which point you can stop the upgrade to resume later. 2. Upgrade MySQL Router to the latest version (same version number as the Shell) 3. Continue or re-execute dba.upgradeMetadata()
Failed Upgrades
If the installed metadata is not available because a previous call to this function ended unexpectedly, this function will restore the metadata to the state it was before the failed upgrade operation.
ATTENTION: The interactive option will be removed in a future release.
|
使用upgradeMetadata来升级(或者还原)MySQL Shell所支持的元数据版本。该函数将比较已安装的元数据方案的版本和MySQL Shell所支持的元数据方案的版本。如果已安装的版本低,那么升级过程就会开始。如果执行dba.upgradeMetadata({dryRun:true}),那么只是模拟运行,实际上不会真地升级元数据。
只要在一个节点上运行dba.upgradeMetadata()执行升级,整个集群的元数据都会得到升级:
MySQL node0:3306 ssl JS > dba.upgradeMetadata() Metadata Schema Upgrade
The topology you are connected to is using an outdated metadata schema version 2.0.0 and needs to be upgraded to 2.1.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: 1 Router account has 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 'node0.example.com:3306' from version 2.0.0 to version 2.1.0. Creating backup of the metadata schema... Step 1 of 1: upgrading from 2.0.0 to 2.1.0... Removing metadata backup... Upgrade process successfully finished, metadata schema is now on version 2.1.0 |
4. 升级MySQL Workbench遇到的问题和处理方法:
由于以下问题,MySQL Workbench在RHEL8.3上只能安装到8.0.21版本:
[root@node0 standard]# yum install mysql-workbench-community-8.0.36-1.el8.x86_64.rpm Updating Subscription Management repositories. Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
BaseOS 2.7 MB/s | 2.8 kB 00:00 AppStream 3.1 MB/s | 3.2 kB 00:00 错误: 问题: conflicting requests - nothing provides libproj.so.15()(64bit) needed by mysql-workbench-community-8.0.36-1.el8.x86_64 (尝试添加 '--skip-broken' 来跳过无法安装的软件包 或 '--nobest' 来不只使用最佳选择的软件包)
|
libproj.so.15这个依赖关系在发行版本原始iso文件中无法找到,需要通过fedora的https://archive.fedoraproject.org/epel提供的一些rpm包来解决。为了方便读者,本文提供这些包的镜像供下载。具体包含两个包:1)proj-datumgrid-1.8-6.3.2.4.el8.noarch.rpm;2)proj-6.3.2-4.el8.x86_64.rpm:
[root@node0 mysql-software]# rpm -ivh proj-datumgrid-1.8-6.3.2.4.el8.noarch.rpm Verifying... ################################# [100%] 准备中... ################################# [100%] 正在升级/安装... 1:proj-datumgrid-1.8-6.3.2.4.el8 ################################# [100%] [root@node0 mysql-software]# rpm -ivh proj-6.3.2-4.el8.x86_64.rpm Verifying... ################################# [100%] 准备中... ################################# [100%] 正在升级/安装... 1:proj-6.3.2-4.el8 ################################# [100%]
|
之后,MySQL Workbench 8.0.36在RHEL8上安装成功:
[root@node0 standard]# yum install mysql-workbench-community-8.0.36-1.el8.x86_64.rpm Updating Subscription Management repositories. Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
上次元数据过期检查:0:40:14 前,执行于 2024年02月23日 星期五 20时55分55秒。 依赖关系解决。 ====================================================================================================== 软件包 架构 版本 仓库 大小 ====================================================================================================== mysql-workbench-community x86_64 8.0.36-1.el8 @commandline 42 M 安装依赖关系: libglvnd-opengl x86_64 1:1.2.0-6.el8 RHAppStream 48 k libzip x86_64 1.5.1-2.module+el8.1.0+3202+af5476b9 RHAppStream 63 k python38-libs x86_64 3.8.3-3.module+el8.3.0+7680+79e7e61a RHAppStream 8.3 M python38-pip-wheel noarch 19.3.1-1.module+el8.3.0+7187+a27ec44b RHAppStream 1.2 M python38-setuptools-wheel noarch 41.6.0-4.module+el8.3.0+7187+a27ec44b RHAppStream 304 k 安装弱的依赖: python38 x86_64 3.8.3-3.module+el8.3.0+7680+79e7e61a RHAppStream 78 k python38-pip noarch 19.3.1-1.module+el8.3.0+7187+a27ec44b RHAppStream 1.9 M python38-setuptools noarch 41.6.0-4.module+el8.3.0+7187+a27ec44b RHAppStream 667 k 启用模块流: php 7.2 python38 3.8
事务概要 ======================================================================================================
总计:54 M 安装大小:267 M 确定吗?[y/N]: y 下载软件包: 运行事务检查 事务检查成功。 运行事务测试 事务测试成功。 运行事务 准备中 : 1/1 安装 : python38-setuptools-wheel-41.6.0-4.module+el8.3.0+7187+a27ec44b.noarch 1/9 安装 : python38-pip-wheel-19.3.1-1.module+el8.3.0+7187+a27ec44b.noarch 2/9 安装 : python38-libs-3.8.3-3.module+el8.3.0+7680+79e7e61a.x86_64 3/9 安装 : python38-3.8.3-3.module+el8.3.0+7680+79e7e61a.x86_64 4/9 运行脚本: python38-3.8.3-3.module+el8.3.0+7680+79e7e61a.x86_64 4/9 安装 : python38-setuptools-41.6.0-4.module+el8.3.0+7187+a27ec44b.noarch 5/9 运行脚本: python38-setuptools-41.6.0-4.module+el8.3.0+7187+a27ec44b.noarch 5/9 安装 : python38-pip-19.3.1-1.module+el8.3.0+7187+a27ec44b.noarch 6/9 运行脚本: python38-pip-19.3.1-1.module+el8.3.0+7187+a27ec44b.noarch 6/9 安装 : libzip-1.5.1-2.module+el8.1.0+3202+af5476b9.x86_64 7/9 安装 : libglvnd-opengl-1:1.2.0-6.el8.x86_64 8/9 安装 : mysql-workbench-community-8.0.36-1.el8.x86_64 9/9 运行脚本: mysql-workbench-community-8.0.36-1.el8.x86_64 9/9 Could not parse file "/usr/share/applications/libreoffice6.3-base.desktop": No such file or directory Could not parse file "/usr/share/applications/libreoffice6.3-calc.desktop": No such file or directory Could not parse file "/usr/share/applications/libreoffice6.3-draw.desktop": No such file or directory Could not parse file "/usr/share/applications/libreoffice6.3-impress.desktop": No such file or directory Could not parse file "/usr/share/applications/libreoffice6.3-math.desktop": No such file or directory Could not parse file "/usr/share/applications/libreoffice6.3-startcenter.desktop": No such file or directory Could not parse file "/usr/share/applications/libreoffice6.3-writer.desktop": No such file or directory Could not parse file "/usr/share/applications/libreoffice6.3-xsltfilter.desktop": No such file or directory
/sbin/ldconfig: /lib64/libk5crypto.so.3 不是符号链接
验证 : libglvnd-opengl-1:1.2.0-6.el8.x86_64 1/9 验证 : libzip-1.5.1-2.module+el8.1.0+3202+af5476b9.x86_64 2/9 验证 : python38-3.8.3-3.module+el8.3.0+7680+79e7e61a.x86_64 3/9 验证 : python38-libs-3.8.3-3.module+el8.3.0+7680+79e7e61a.x86_64 4/9 验证 : python38-pip-19.3.1-1.module+el8.3.0+7187+a27ec44b.noarch 5/9 验证 : python38-pip-wheel-19.3.1-1.module+el8.3.0+7187+a27ec44b.noarch 6/9 验证 : python38-setuptools-41.6.0-4.module+el8.3.0+7187+a27ec44b.noarch 7/9 验证 : python38-setuptools-wheel-41.6.0-4.module+el8.3.0+7187+a27ec44b.noarch 8/9 验证 : mysql-workbench-community-8.0.36-1.el8.x86_64 9/9 Installed products updated.
已安装: libglvnd-opengl-1:1.2.0-6.el8.x86_64 libzip-1.5.1-2.module+el8.1.0+3202+af5476b9.x86_64 mysql-workbench-community-8.0.36-1.el8.x86_64 python38-3.8.3-3.module+el8.3.0+7680+79e7e61a.x86_64 python38-libs-3.8.3-3.module+el8.3.0+7680+79e7e61a.x86_64 python38-pip-19.3.1-1.module+el8.3.0+7187+a27ec44b.noarch python38-pip-wheel-19.3.1-1.module+el8.3.0+7187+a27ec44b.noarch python38-setuptools-41.6.0-4.module+el8.3.0+7187+a27ec44b.noarch python38-setuptools-wheel-41.6.0-4.module+el8.3.0+7187+a27ec44b.noarch
完毕!
|
观察一下系统里安装的所有mysql开头的包:
[root@node0 mysql-software]# rpm -qa | grep mysql mysql-community-test-8.0.36-1.el8.x86_64 mysql-community-libs-8.0.36-1.el8.x86_64 mysql-community-common-8.0.36-1.el8.x86_64 mysql-community-server-8.0.36-1.el8.x86_64 mysql-shell-8.0.36-1.el8.x86_64 mysql-community-client-8.0.36-1.el8.x86_64 mysql-router-community-8.0.36-1.el8.x86_64 mysql-community-icu-data-files-8.0.36-1.el8.x86_64 mysql-community-client-plugins-8.0.36-1.el8.x86_64 mysql-community-devel-8.0.36-1.el8.x86_64 mysql-workbench-community-8.0.36-1.el8.x86_64
|