环境说明
本文档均在 admin 用户下进行,下文示例中 OBD 和 OceanBase 集群的部署用户为 admin。
OBD 版本:1.6.0 版本升级至 1.6.2 版本。
OceanBase 版本:4.0.0.0 版本升级至 4.0.0.0-bp2 版本。
升级 OBD
在线升级
前提条件: 机器可以访问公网。
1、确认远程仓库开启状态。
说明
若 Enabled 列的状态为 False,则需要执行
obd mirror enable remote
开启远程仓库。
[admin@obtest004 ~]$ obd mirror list
+------------------------------------------------------------------+
| Mirror Repository List |
+----------------------------+--------+---------+------------------+
| SectionName | Type | Enabled | Update Time |
+----------------------------+--------+---------+------------------+
| oceanbase.community.stable | remote | True | 2023-01-04 18:27 |
| oceanbase.development-kit | remote | True | 2023-01-04 18:27 |
| local | local | - | 2023-01-05 18:24 |
+----------------------------+--------+---------+------------------+
2、直接使用 obd update
命令升级 OBD。(此处需要 sudo 方式执行)
[admin@obtest004 ~]$ sudo obd update
Update OceanBase-community-stable-el7 ok
Update OceanBase-development-kit-el7 ok
Found a higher version package for OBD
name: ob-deploy
version: 1.6.2
release:10.el7
arch: x86_64
md5: 4542035d1b1af411c93cfe9f1dd78327c2ea05d4
Upgrade successful.
Current version : 1.6.2
[admin@obtest004 ~]$ obd --version
OceanBase Deploy: 1.6.2
REVISION: 188385cf71729311c33df8cfa2d9b059ade337fd
BUILD_BRANCH: HEAD
BUILD_TIME: Dec 14 2022 11:34:49OURCE
Copyright (C) 2021 OceanBase
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
离线升级
前提条件: 本地已上传好了 OBD 1.6.2 版本的 rpm 包 ob-deploy-1.6.2-10.el7.x86_64.rpm
。
下载地址: OceanBase 社区
1、禁用远程镜像。
[admin@obtest004 opt]# obd mirror disable remote
Disable remote ok
2、拷贝 OBD 1.6.2 版本的 rpm 包到本地镜像库。
[admin@obtest004 opt]# obd mirror clone /opt/ob-deploy-1.6.2-10.el7.x86_64.rpm
name: ob-deploy
version: 1.6.2
release:10.el7
arch: x86_64
md5: 4542035d1b1af411c93cfe9f1dd78327c2ea05d4
add /opt/ob-deploy-1.6.2-10.el7.x86_64.rpm to local mirror
3、开始升级 OBD。(此处需要 sudo 方式执行)
[admin@obtest004 opt]# sudo obd update
Found a higher version package for OBD
name: ob-deploy
version: 1.6.2
release:10.el7
arch: x86_64
md5: 4542035d1b1af411c93cfe9f1dd78327c2ea05d4
Upgrade successful.
Current version : 1.6.2
升级 OceanBase
在线升级
前提条件: 机器可以访问公网。
1、确认远程仓库开启状态。
说明
若 Enabled 列的状态为 False,则需要执行
obd mirror enable remote
开启远程仓库。
[admin@obtest004 ~]$ obd mirror list
+------------------------------------------------------------------+
| Mirror Repository List |
+----------------------------+--------+---------+------------------+
| SectionName | Type | Enabled | Update Time |
+----------------------------+--------+---------+------------------+
| oceanbase.community.stable | remote | True | 2023-01-04 18:27 |
| oceanbase.development-kit | remote | True | 2023-01-04 18:27 |
| local | local | - | 2023-01-05 18:24 |
+----------------------------+--------+---------+------------------+
2、查看 md5 值,同版本升级,需要 md5 值做唯一验证。
说明
同版本升级,大版本号一致,需要根据版本日期确定对应升级版本的 md5 值。
[admin@obtest004 ~]$ obd mirror list oceanbase.community.stable | grep -e " oceanbase-ce " | grep -e " 4.0.0.0 "
| oceanbase-ce | 4.0.0.0 | 100000272022110114.el7 | x86_64 | 759074414c7b7b723013855353f62a7ba0aae0f493216ef2511825850ce77b51 |
| oceanbase-ce | 4.0.0.0 | 100000282022112511.el7 | x86_64 | debb18ab3c0b3d16f145c41cd21c30686863580b721d45ddaa068e6309e03b64 |
| oceanbase-ce | 4.0.0.0 | 102000032022120718.el7 | x86_64 | c63bb73384b17d74299b34fe3aceb0ae310fd319d2ccdb1acd39f31ba6673198 |
3、使用 obd cluster upgrade
命令升级 OceanBase 数据库。
# 本例升级的为上图中的 102000032022120718.el7 版本
obd cluster upgrade testob -c oceanbase-ce -V 4.0.0.0 --usable c63bb73384b17d74299b34fe3aceb0ae310fd319d2ccdb1acd39f31ba6673198
4、连接数据库,验证升级后版本。
离线升级
前提条件: 本地已上传好 OceanBase 所需的 4.0.0.0-bp2 版本的 rpm 包 oceanbase-ce-4.0.0.0-102000032022120718.el7.x86_64.rpm
。
下载地址: OceanBase 社区
1、升级完的 OBD,远程仓库默认是开启状态,需要再次禁用。
[admin@obtest004 opt]# obd mirror disable remote
Disable remote ok
2、拷贝 OceanBase 新版本的 rpm 包到本地镜像库。
[admin@obtest004 opt]# obd mirror clone /opt/oceanbase-ce-4.0.0.0-102000032022120718.el7.x86_64.rpm
name: oceanbase-ce
version: 4.0.0.0
release:102000032022120718.el7
arch: x86_64
md5: e1c71a4cb252e51f210aae129cee0f09613d42bb
add /opt/oceanbase-ce-4.0.0.0-102000032022120718.el7.x86_64.rpm to local mirror
3、查看 md5 值,同版本升级,需要 md5 值做唯一验证。
[admin@obtest004 opt]# obd mirror list local
+----------------------------------------------------------------------------------------------------------+
| local Package List |
+-------------------+---------+------------------------+--------+------------------------------------------+
| name | version | release | arch | md5 |
+-------------------+---------+------------------------+--------+------------------------------------------+
| oceanbase-ce | 4.0.0.0 | 100000272022110114.el7 | x86_64 | 42611dc51ca9bb28f36e60e4406ceea4a74914c7 |
| obproxy-ce | 4.0.0 | 5.el7 | x86_64 | de53232a951184fad75b15884458d85e31d2f6c3 |
| oceanbase-ce-libs | 4.0.0.0 | 100000272022110114.el7 | x86_64 | 188919f8128394bf9b62e3989220ded05f1d14da |
| ob-deploy | 1.6.2 | 10.el7 | x86_64 | 4542035d1b1af411c93cfe9f1dd78327c2ea05d4 |
| oceanbase-ce | 4.0.0.0 | 102000032022120718.el7 | x86_64 | e1c71a4cb252e51f210aae129cee0f09613d42bb |
+-------------------+---------+------------------------+--------+------------------------------------------+
4、升级 OceanBase。
[admin@obtest004 opt]# obd cluster upgrade testob -c oceanbase-ce -V 4.0.0.0 --usable e1c71a4cb252e51f210aae129cee0f09613d42bb
Get local repositories and plugins ok
+-----------------------------------------------------------------------------------------------------+
| Search oceanbase-ce 4.0.0.0 Result |
+--------------+---------+------------------------+--------+------------------------------------------+
| name | version | release | arch | md5 |
+--------------+---------+------------------------+--------+------------------------------------------+
| oceanbase-ce | 4.0.0.0 | 100000272022110114.el7 | x86_64 | 42611dc51ca9bb28f36e60e4406ceea4a74914c7 |
| oceanbase-ce | 4.0.0.0 | 102000032022120718.el7 | x86_64 | e1c71a4cb252e51f210aae129cee0f09613d42bb |
+--------------+---------+------------------------+--------+------------------------------------------+
install oceanbase-ce-4.0.0.0 for local ok
Open ssh connection ok
Connect to observer ok
+-------------------------------------------------------------------------------------------------------------+
| Packages Will Be Used |
+--------------+---------+------------------------+--------+------------------------------------------+-------+
| name | version | release | arch | md5 | mark |
+--------------+---------+------------------------+--------+------------------------------------------+-------+
| oceanbase-ce | 4.0.0.0 | 100000272022110114.el7 | x86_64 | 42611dc51ca9bb28f36e60e4406ceea4a74914c7 | start |
| oceanbase-ce | 4.0.0.0 | 102000032022120718.el7 | x86_64 | e1c71a4cb252e51f210aae129cee0f09613d42bb | dest |
+--------------+---------+------------------------+--------+------------------------------------------+-------+
If you use a non-official release, we cannot guarantee a successful upgrade or technical support when you fail. Make sure that you want to use the above package to upgrade. [y/n]: y
Remote oceanbase-ce-4.0.0.0-102000032022120718.el7-e1c71a4cb252e51f210aae129cee0f09613d42bb repository install ok
Remote oceanbase-ce-4.0.0.0-102000032022120718.el7-e1c71a4cb252e51f210aae129cee0f09613d42bb repository lib check ok
Start observer ok
observer program health check ok
Connect to observer ok
Exec upgrade_checker.py ok
Enable upgrade mode ok
Exec upgrade_pre.py ok
Upgrade ok
Remote oceanbase-ce-4.0.0.0-102000032022120718.el7-e1c71a4cb252e51f210aae129cee0f09613d42bb repository lib check ok
Stop observer ok
Start observer ok
observer program health check ok
Connect to observer ok
Exec upgrade_post.py ok
Disable upgrade mode ok
Root inspection ok
Exec upgrade_post_checker.py ok
Wait for observer init ok
+--------------------------------------------------+
| observer |
+----------------+---------+------+-------+--------+
| ip | version | port | zone | status |
+----------------+---------+------+-------+--------+
| 172.30.199.193 | 4.0.0.0 | 2881 | zone1 | ACTIVE |
+----------------+---------+------+-------+--------+
obclient -h172.30.199.193 -P2881 -uroot -Doceanbase -A
升级 OBProxy
4.0.0.0 场景暂无最新小版本 OBProxy 的升级,如需升级 OBProxy 组件,请参考如下方法。
-
OBProxy 3.2.0 版本升级至 OBProxy 3.2.3 版本时,请参考 如何升级 obproxy 到 obproxy-ce 3.2.3。
-
OBProxy 3.2.3 及其以上版本的升级步骤与 OceanBase 升级步骤一致,需要填写对应的组件名以及 MD5 值。
FAQ
Q1:升级 OceanBase 报错:[ERROR] Too many match
A1: 检查升级命令是否有 --usable 参数,值为 md5 值。
Q2:升级 OceanBase 报错 fail to get upgrade graph: ‘NoneType’ object has no attribute ‘version’
A2:3.x 版本不支持直接升级至 4.x。