当前位置:网站首页>升级 TiDB Operator
升级 TiDB Operator
2022-07-06 07:58:00 【添香小铺】
本文介绍如何升级 TiDB Operator 到指定版本。你可以选择在线升级或离线升级。
升级注意事项
如果使用 v1.3.0-beta.1 及更早版本的 TiDB Operator 跨 Kubernetes 集群部署 TiDB 集群,直接升级 TiDB Operator 会导致集群滚动更新并进入异常状态。如果从更早版本升级 TiDB Operator 到 v1.3,你需要执行以下操作:
- 更新 CRD。
- 修改 TidbCluster 定义将
spec.acrossK8s
字段设置为true
。 - 升级 TiDB Operator。
弃用 Pod
ValidatingWebhook
和MutatingWebhook
。如果使用 v1.2 及更早版本的 TiDB Operator 在集群部署了 Webhook,并启用了 PodValidatingWebhook
和MutatingWebhook
,升级 TiDB Operator 到 v1.3.0-beta.1 及之后版本,PodValidatingWebhook
和MutatingWebhook
被删除,但这不会对 TiDB 集群管理产生影响,也不会影响正在运行的 TiDB 集群。
在线升级
如果服务器可以访问外网,你可以按照以下步骤在线升级 TiDB Operator:
升级 TiDB Operator 前,确保 Helm repo 包含你需要升级的 TiDB Operator 版本。通过以下命令查看 Helm repo 包含的 TiDB Operator 版本:
helm search repo -l tidb-operator
如果输出中未包含你需要的新版本,可以使用
helm repo update
命令更新 repo。详情请参考配置 Helm repo。更新 Kubernetes 的 CustomResourceDefinition (CRD)。关于 CRD 的更多信息,请参阅 CustomResourceDefinition。
如果 Kubernetes 版本大于等于 1.16:
如果 TiDB Operator 从 v1.2.x 及更早版本升级到 v1.3.x 及以后版本,需要先执行下面命令创建新增加的 TidbNGMonitoring CRD。如果是 v1.3.x 及以后版本的 TiDB Operator 升级,可跳过这一步。
kubectl create -f https://raw.githubusercontent.com/pingcap/tidb-operator/${operator_version}/manifests/crd/v1/pingcap.com_tidbngmonitorings.yaml
更新 CRD。
kubectl replace -f https://raw.githubusercontent.com/pingcap/tidb-operator/${operator_version}/manifests/crd.yaml && \ kubectl get crd tidbclusters.pingcap.com
如果 Kubernetes 版本小于 1.16:
如果 TiDB Operator 从 v1.2.x 及更早版本升级到 v1.3.x 及以后版本,需要先执行下面命令创建新增加的 TidbNGMonitoring CRD。如果是 v1.3.x 及以后版本的 TiDB Operator 升级,可跳过这一步。
kubectl create -f https://raw.githubusercontent.com/pingcap/tidb-operator/${operator_version}/manifests/crd/v1beta1/pingcap.com_tidbngmonitorings.yaml
更新 CRD。
kubectl replace -f https://raw.githubusercontent.com/pingcap/tidb-operator/${operator_version}/manifests/crd_v1beta1.yaml && \ kubectl get crd tidbclusters.pingcap.com
本文以 TiDB Operator v1.3.5 为例,你需要替换
${operator_version}
为你要升级到的 TiDB Operator 版本。获取你要升级的
tidb-operator
chart 中的values.yaml
文件:mkdir -p ${HOME}/tidb-operator/v1.3.5 && \ helm inspect values pingcap/tidb-operator --version=v1.3.5 > ${HOME}/tidb-operator/v1.3.5/values-tidb-operator.yaml
修改
${HOME}/tidb-operator/v1.3.5/values-tidb-operator.yaml
中operatorImage
镜像版本为要升级到的版本。如果你在旧版本
values.yaml
中设置了自定义配置,将自定义配置合并到${HOME}/tidb-operator/v1.3.5/values-tidb-operator.yaml
中。执行升级:
helm upgrade tidb-operator pingcap/tidb-operator --version=v1.3.5 -f ${HOME}/tidb-operator/v1.3.5/values-tidb-operator.yaml
Pod 全部正常启动之后,运行以下命令确认 TiDB Operator 镜像版本:
kubectl get po -n tidb-admin -l app.kubernetes.io/instance=tidb-operator -o yaml | grep 'image:.*operator:'
如果输出类似下方的结果,则表示升级成功。其中,
v1.3.5
表示已升级到的版本号。image: pingcap/tidb-operator:v1.3.5 image: docker.io/pingcap/tidb-operator:v1.3.5 image: pingcap/tidb-operator:v1.3.5 image: docker.io/pingcap/tidb-operator:v1.3.5
注意
TiDB Operator 升级之后,所有 TiDB 集群中的
discovery
Deployment 都会自动升级到对应的 TiDB Operator 版本。
离线升级
如果服务器没有连接外网,你可以按照以下步骤离线升级 TiDB Operator:
使用有外网的机器,下载升级所需的文件和镜像。
下载 TiDB Operator 需要的
crd.yaml
文件。关于 CRD 的更多信息,请参阅 CustomResourceDefinition。如果 Kubernetes 版本大于等于 1.16:
wget -O crd.yaml https://raw.githubusercontent.com/pingcap/tidb-operator/${operator_version}/manifests/crd.yaml
如果 Kubernetes 版本小于 1.16:
wget -O crd.yaml https://raw.githubusercontent.com/pingcap/tidb-operator/${operator_version}/manifests/crd_v1beta1.yaml
本文以 TiDB Operator v1.3.5 为例,你需要替换
${operator_version}
为你要升级到的 TiDB Operator 版本。下载
tidb-operator
chart 包文件:wget http://charts.pingcap.org/tidb-operator-v1.3.5.tgz
下载 TiDB Operator 升级所需的 Docker 镜像:
docker pull pingcap/tidb-operator:v1.3.5 docker pull pingcap/tidb-backup-manager:v1.3.5 docker save -o tidb-operator-v1.3.5.tar pingcap/tidb-operator:v1.3.5 docker save -o tidb-backup-manager-v1.3.5.tar pingcap/tidb-backup-manager:v1.3.5
将下载的文件和镜像上传到需要升级的服务器上,在服务器上按照以下步骤进行安装:
如果 TiDB Operator 从 v1.2.x 及更早版本升级到 v1.3.x 及以后版本,需要先执行下面命令创建新增加的 TidbNGMonitoring CRD。如果是 v1.3.x 及以后版本的 TiDB Operator 升级,可跳过这一步。
kubectl create -f ./crd.yaml
对于其他 CRD,执行该命令时会报 "AlreadyExists" 的错误,可以忽略该错误。
升级 TiDB Operator 需要的
crd.yaml
文件:kubectl replace -f ./crd.yaml
解压
tidb-operator
chart 包文件,并拷贝values.yaml
文件到升级目录:tar zxvf tidb-operator-v1.3.5.tgz && \ mkdir -p ${HOME}/tidb-operator/v1.3.5 && \ cp tidb-operator/values.yaml ${HOME}/tidb-operator/v1.3.5/values-tidb-operator.yaml
安装 Docker 镜像到服务器上:
docker load -i tidb-operator-v1.3.5.tar && \ docker load -i tidb-backup-manager-v1.3.5.tar
修改
${HOME}/tidb-operator/v1.3.5/values-tidb-operator.yaml
中operatorImage
镜像版本为要升级到的版本。如果你在旧版本
values.yaml
中设置了自定义配置,将自定义配置合并到${HOME}/tidb-operator/v1.3.5/values-tidb-operator.yaml
中。执行升级:
helm upgrade tidb-operator ./tidb-operator --version=v1.3.5 -f ${HOME}/tidb-operator/v1.3.5/values-tidb-operator.yaml
Pod 全部正常启动之后,运行以下命令确认 TiDB Operator 镜像版本:
kubectl get po -n tidb-admin -l app.kubernetes.io/instance=tidb-operator -o yaml | grep 'image:.*operator:'
如果输出类似下方的结果,则表示升级成功。其中,
v1.3.5
表示已升级到的版本号。image: pingcap/tidb-operator:v1.3.5 image: docker.io/pingcap/tidb-operator:v1.3.5 image: pingcap/tidb-operator:v1.3.5 image: docker.io/pingcap/tidb-operator:v1.3.5
注意
TiDB Operator 升级之后,所有 TiDB 集群中的
discovery
Deployment 都会自动升级到对应的 TiDB Operator 版本。
边栏推荐
- "Designer universe": "benefit dimension" APEC public welfare + 2022 the latest slogan and the new platform will be launched soon | Asia Pacific Financial Media
- C语言自定义类型:结构体
- 上线APS系统,破除物料采购计划与生产实际脱钩的难题
- Hackathon ifm
- Common functions for PHP to process strings
- Vit (vision transformer) principle and code elaboration
- [untitled]
- 08- [istio] istio gateway, virtual service and the relationship between them
- P3047 [USACO12FEB]Nearby Cows G(树形dp)
- [t31zl intelligent video application processor data]
猜你喜欢
datax自检报错 /datax/plugin/reader/._drdsreader/plugin.json]不存在
Epoll and IO multiplexing of redis
A Closer Look at How Fine-tuning Changes BERT
Go learning notes (3) basic types and statements (2)
esRally国内安装使用避坑指南-全网最新
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
Opencv learning notes 9 -- background modeling + optical flow estimation
Asia Pacific Financial Media | art cube of "designer universe": Guangzhou community designers achieve "great improvement" in urban quality | observation of stable strategy industry fund
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
Solution: intelligent site intelligent inspection scheme video monitoring system
随机推荐
MFC sends left click, double click, and right click messages to list controls
将 NFT 设置为 ENS 个人资料头像的分步指南
软件开发的一点随记
onie支持pice硬盘
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
flask返回文件下载
08- [istio] istio gateway, virtual service and the relationship between them
Asia Pacific Financial Media | "APEC industry +" Western Silicon Valley invests 2trillion yuan in Chengdu Chongqing economic circle to catch up with Shanghai | stable strategy industry fund observatio
CAD ARX 获取当前的视口设置
649. Dota2 Senate
二叉树创建 & 遍历
861. Score after flipping the matrix
Asia Pacific Financial Media | female pattern ladyvision: forced the hotel to upgrade security. The drunk woman died in the guest room, and the hotel was sentenced not to pay compensation | APEC secur
Description of octomap averagenodecolor function
Understanding of law of large numbers and central limit theorem
好用的TCP-UDP_debug工具下载和使用
珠海金山面试复盘
Leetcode question brushing record | 203_ Remove linked list elements
(lightoj - 1410) consistent verbs (thinking)
Artcube information of "designer universe": Guangzhou implements the community designer system to achieve "great improvement" of urban quality | national economic and Information Center