OceanBase on K8S 升级篇

本篇从OceanBase on K8S的升级操作开始(操作流程十分简单,大家看了后面的内容就知道了,这也是我为啥把数据库跑在k8s中的原因),也分享了各组件基于OCP(OceanBase on 物理机的管控平台)升级操作,通过本文,你就了解了多种环境、多种方式将OceanBase、OBproxy、OCP/OB-DashBoard这3个组件升级的升级流程和注意事项。
看完本文OceanBase的升级操作基本全部搞定。
一、OceanBase升级
1、升级注意事项
OceanBase跨版本升级是有要求和限制的,需要详细了解后才能升级
(1)OceanBase 集群暂不支持 V4.0.0.0 之前的版本升级到 V4.x 版本。(2)仅支持 V4.2.1 BP2 及之前的版本升级到 V4.2.5 版本,V4.2.1 BP3 及之后 V4.2.1 系列不支持升级到 V4.2.5 版本。在升级时请注意升级路径。(3)V4.2.2.1 版本对于 V4.2.2.0 版本是 Barrier 版本,V4.2.2.0 升级到未来更高版本时需要经停 V4.2.2.1。
(4)V4.2.3/V4.2.4 系列版本可以直接升级到 V4.2.5 版本。
  • 2、OceanBase升级对业务影响
  • 整个升级过程对应用无感知,应用无需配合服务端做任何的停写停服务操作。OceanBase 集群会按照 Zone 的顺序进行升级。升级过程中,分区 Leader 会在各个 Zone 间进行切主动作,所以业务对SQL执行延迟敏感,OceanBase升级建议放到业务低峰期操作。
  • 3、OceanBase升级DBA操作注意事项
    • 禁止 DDL:升级过程中的部分阶段需要禁止 DDL,升级完成后会自动打开。

    • 禁止 major freeze:部分版本之间的升级会禁止合并,升级完成后会自动打开。

    • 禁止迁移复制和负载均衡:部分版本之间的升级会禁止迁移复制和负载均衡。

    • 禁止物理备份恢复:集群升级过程中不会发起物理基线备份、物理恢复。

    • 禁止 switchover/failover:升级过程中不允许发起备库 switchover/failover

    • 禁止新建租户。


  • 4、OceanBase on K8S升级
    1.     有2种升级方式,分别是命令行和基于OB-DashBoard管控平台升级。
    2. (1)命令行升级

    修改集群的oceanbase-test.yaml文件,主要就是将spec.observer.image 修改为高版本的镜像。

    # 修改前spec:  observer:    image: oceanbase/oceanbase-cloud-native:4.2.0.0-101000032023091319# 修改后spec:  observer:    image: oceanbase/oceanbase-cloud-native:4.2.1.1-101000062023110109

    配置文件修改保存后,需运行如下命令应用生效

    kubectl apply -f oceanbase-test.yaml -n oceanbase-test

    然后观察pods升级情况

    kubectl get pods -n oceanbase-test

    1. (2)基于OB-DashBoard升级(很简单)

    进入具体的集群概览页面,右上角选择:升级,填入高版本的OceanBase目的镜像地址,确定即可。


5、OceanBase on 裸金属 升级(基于OCP)
  1. (1)下载软件包
  1. (2)上传到OCP
  1. (3)执行升级操作

进度到具体的OB集群,选择升级集群

OCP选择合适的OB版本,点击升级就好。

生成任务工单并执行

  1. 查看升级任务
二、OBproxy升级
1、升级注意事项
OBproxy和OBServer 升级顺序:建议先升级 OBServer 版本,然后再升级 OBproxy 版本。
2、OBproxy on K8S升级
基于OB-DashBoard升级,登录DashBoard,选择OBproxy,进入要升级的OBproxy集群详情,在“详细配置”右侧有“编辑”按钮。选择高版本的OBproxy镜像地址即可。
3、OCP中升级OBproxy步骤
  1. 登录 OCP,在左侧导航栏单击 OBProxy。在集群列表中选择需要操作的 OBProxy 集群,进入 OBProxy 集群 概览 页面。

  2. 进行如下操作:

    • 在 OBProxy 列表 中,找到待升级的 OBProxy,在对应的 操作 列中,单击 升级,选择或上传升级版本包,单击 确定,可以升级单个 OBProxy。

    • 在 OBProxy 列表 中,选择多个 OBProxy,在列表右上方单击 批量升级,选择或上传升级版本包,单击 确定,可以升级多个 OBProxy。

  3. 在弹出框中选择 升级版本


三、OB-DashBoard(K8S中的丐版OCP)和OCP管控平台升级
1、OB-DashBoard升级
  1. 有2种升级方法:
  2. (1)基于helm安装,需要先卸载已有的dashboard,然后再重新install
helm uninstall ob-ocp -n oceanbase-dashboard helm install ob-ocp ob-operator/oceanbase-dashboard --version=0.3.1 -n oceanbase-dashboard

  1. (2)编辑deloyment升级:修改当前的deployment里面的镜像地址来升级
kubectl get deploy -n oceanbase-dashboard kubectl edit deploy oceanbase-dashboard-ob-ocp -n oceanbase-dashboard 找到dashboard的image并且修改即可

2、OCP升级步骤

(1)下载ocp安装包:ocp-all-in-one-4.3.2-20240925174740.el7.x86_64.tar.gz

(2)建议确认obd安装版本为最新

obd --version

如果不是最新obd包,需要下载当前最新的obd安装包:ob-deploy-2.10.1-1.el7.x86_64.rpm   

/opt/ocp-4.3.2/ocp-all-in-one/bin# obd --versionOceanBase Deploy: 1.6.2REVISION: 188385cf71729311c33df8cfa2d9b059ade337fdBUILD_BRANCH: HEADBUILD_TIME: Dec 14 2022 11:34:49OURCECopyright (C) 2021 OceanBaseLicense GPLv3+: GNU GPL version 3 or later.This is free software: you are free to change and redistribute it.There is NO WARRANTY, to the extent permitted by law./opt# alien -d ob-deploy-2.10.1-1.el7.x86_64.rpmWarning: Skipping conversion of scripts in package ob-deploy: postinstWarning: Use the --scripts parameter to include the scripts.ob-deploy_2.10.1-2_amd64.deb generatedopt# dpkg -i ob-deploy_2.10.1-2_amd64.deb(Reading database ... 172281 files and directories currently installed.)Preparing to unpack ob-deploy_2.10.1-2_amd64.deb ...Unpacking ob-deploy (2.10.1-2) over (1.6.2-11) ...Setting up ob-deploy (2.10.1-2) ...Configuration file '/etc/profile.d/obd.sh' ==> Modified (by you or by a script) since installation. ==> Package distributor has shipped an updated version.   What would you like to do about it ?  Your options are:    Y or I  : install the package maintainer's version    N or O  : keep your currently-installed version      D     : show the differences between the versions      Z     : start a shell to examine the situation The default action is to keep your current version.*** obd.sh (Y/I/N/O/D/Z) [default=N] ? YInstalling new version of config file /etc/profile.d/obd.sh ...Processing triggers for libc-bin (2.27-3ubuntu1.2) .../opt# which obd/usr/bin/obd

OCP升级操作:cd ocp-all-in-one/bin && sh install.sh

/opt/ocp-4.3.2 [PRODUCTION]$ cd ocp-all-in-one/bin && bash install.shinstall obd as sudoNo previous obd installed, try install...rpm: RPM should not be used directly install RPM packages, use Alien instead!rpm: However assuming you know what you are doing...error: Failed dependencies:    /bin/sh is needed by ob-deploy-2.10.0-3.el7.x86_64install.sh: line 99: /usr/bin/obd: No such file or directoryinstall.sh: line 100: /usr/bin/obd: No such file or directoryinstall.sh: line 101: /usr/bin/obd: No such file or directoryinstall.sh: line 104: /usr/bin/obd: No such file or directoryadd auto set env logic to profile: /home/zhihu/.bashrc######################################################################################### Install Finished=========================================================================================Setup Environment:              source ~/.oceanbase-all-in-one/bin/env.shQuick Start:                    obd demoUse Web Service to install:     obd webUse Web Service to upgrade:     obd web upgradeMore Details:                   obd -h=========================================================================================/opt/ocp-4.3.2/ocp-all-in-one/bin [PRODUCTION]$ obd --versionOceanBase Deploy: 2.10.1REVISION: 9870cf1b400be9002d851b9a165b043f1da4e0e7BUILD_BRANCH: HEADBUILD_TIME: Oct 12 2024 16:15:27OURCECopyright (C) 2021 OceanBaseLicense GPLv3+: GNU GPL version 3 or later.This is free software: you are free to change and redistribute it.There is NO WARRANTY, to the extent permitted by law./opt/ocp-4.3.2/ocp-all-in-one/bin [PRODUCTION]$ source ~/.oceanbase-all-in-one/bin/env.sh/opt/ocp-4.3.2/ocp-all-in-one/bin [PRODUCTION]$ obd web upgradestart OBD WEB in 0.0.0.0:8680please open http://10.xxx.xxx.109:8680/#/updateWelcome

登录:http://10.xxx.xxx.109:8680/#/updateWelcome,然后根据页面提示操作就好,相关页面如下

四、总结

本文分享了OceanBase、OBproxy、OCP和OB-DashBoard这3种组件,分别在K8S和物理机这2种环境下的升级注意事项和操作流程,看完这一篇OceanBase的升级基本就全部掌握了。

请使用浏览器的分享功能分享到微信等