-
Notifications
You must be signed in to change notification settings - Fork 125
tiup: use tibd operator to rollback tidb #2599
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
hfxsd
wants to merge
14
commits into
pingcap:master
Choose a base branch
from
hfxsd:roll-back-a-tidb-cluster
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+79
−1
Open
Changes from 12 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
4e7be40
Create roll-back-a-tidb-cluster.md
hfxsd 284cc83
Update roll-back-a-tidb-cluster.md
hfxsd 8d0133f
Update TOC.md
hfxsd ddc3b13
Update roll-back-a-tidb-cluster.md
hfxsd 47f8916
Update roll-back-a-tidb-cluster.md
hfxsd 25a4e71
Update roll-back-a-tidb-cluster.md
hfxsd 5bc51f7
Update TOC.md
hfxsd 4bd7e80
delete 检查当前集群状况
hfxsd 975ce2f
Apply suggestions from code review
hfxsd 05fd554
Apply suggestions from code review
hfxsd 5a534f3
Update zh/roll-back-a-tidb-cluster.md
hfxsd 0cca279
Update zh/roll-back-a-tidb-cluster.md
hfxsd 9fef20c
Update roll-back-a-tidb-cluster.md
hfxsd e2e2b78
Update zh/roll-back-a-tidb-cluster.md
hfxsd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| --- | ||
| title: 回退 Kubernetes 上的 TiDB 集群 | ||
| summary: 介绍如何回退 Kubernetes 上的 TiDB 集群。 | ||
| --- | ||
|
|
||
| # 回退 Kubernetes 上的 TiDB 集群 | ||
|
|
||
| 本文介绍如何回退 Kubernetes 上的 TiDB 集群。 | ||
|
|
||
| 如果你使用 TiDB Operator 部署管理 Kubernetes 上的 TiDB 集群,可以通过回退 TiDB 集群到指定补丁版本,减少新版本对业务的影响。 | ||
|
|
||
| 在回退 Kubernetes 上的 TiDB 集群时,TiDB Operator 会串行地删除各个组件当前版本的 Pod,并创建指定版本的 Pod。当指定版本的 Pod 正常运行后,再处理下一个 Pod。 | ||
|
|
||
| 滚动回退时,TiDB Operator 会自动处理 PD 和 TiKV 的 Leader 迁移。因此,在多节点的部署拓扑下(最小环境要求:3 个 PD、3 个 TiKV、3 个 TiDB),滚动回退 TiKV、PD 不会影响业务正常运行。对于有连接重试功能的客户端,滚动回退 TiDB 同样不会影响业务。 | ||
hfxsd marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
hfxsd marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ## 支持回退的版本 | ||
|
|
||
| 本文档适用于以下回退路径: | ||
|
|
||
| - 使用 TiDB 从 v7.5.Y 版本回退至 v7.5.X,其中 Y > 0, X ≥ 0, 且 Y > X。 | ||
|
|
||
| > **警告:** | ||
| > | ||
| > 其他补丁版本的回退未经验证,如直接回退,可能会产生非预期的问题。 | ||
|
|
||
| ## 注意事项 | ||
|
|
||
| 回退版本时,请注意以下事项: | ||
|
|
||
| - 对于无法进行连接重试的客户端,版本回退会导致连接到被关闭的 TiDB 节点的数据库的连接失效,造成部分业务请求失败。对于这类业务,推荐在客户端添加重试功能,或者在低峰期进行 TiDB 的滚动更新操作。 | ||
| - 在回退 TiDB 集群的过程中,请勿执行 DDL 语句,否则可能会出现行为未定义的问题。 | ||
| - 回退的集群内的各组件应该使用相同版本。 | ||
| - Changefeed 默认配置值在回退过程中不会被更改,已经修改的值,在回退过程中也不会被修改。 | ||
|
|
||
| ## 回退前的准备工作 | ||
|
|
||
| ### 查阅兼容性变更 | ||
|
|
||
| - TiDB 目前仅支持有限的补丁版本回退。请参见[支持回退的版本](#支持回退的版本)。 | ||
| - 仅支持 PD、TiDB、TiKV、TiFlash、TiCDC、BR、PITR 组件的补丁版本回退。 | ||
| - 查看对应版本的 [Release Notes](https://docs.pingcap.com/zh/tidb/stable/release-notes) 中的兼容性变更。如果有任何变更影响到回退,请采取相应的措施。例如,从 TiDB v7.5.2 回退至 v7.5.1 时,需查阅以下各版本的兼容性变更: | ||
|
|
||
| - [TiDB v7.5.1 Release Notes](https://docs.pingcap.com/zh/tidb/stable/release-7.5.1#兼容性变更) 中的兼容性变更 | ||
| - [TiDB v7.5.2 Release Notes](https://docs.pingcap.com/zh/tidb/stable/release-7.5.2#兼容性变更) 中的兼容性变更 | ||
|
|
||
| ### 检查当前集群的 DDL | ||
|
|
||
| 集群中有 DDL 语句正在被执行时,请勿进行版本回退操作。被执行的 DDL 语句通常为 [`ADD INDEX`](https://docs.pingcap.com/zh/tidb/stable/sql-statement-add-index) 和列类型变更等耗时较久的 DDL 语句。 | ||
|
|
||
| 在回退前,为避免回退过程中出现未定义行为或其他故障,建议执行下列操作: | ||
|
|
||
| 1. 使用 [`ADMIN SHOW DDL`](https://docs.pingcap.com/zh/tidb/stable/sql-statement-admin-show-ddl) 命令查看集群中是否有正在进行的 DDL Job。 | ||
|
|
||
| 2. 如需回退,请等待 DDL 执行完成,或使用 [`ADMIN CANCEL DDL`](https://docs.pingcap.com/zh/tidb/stable/sql-statement-admin-cancel-ddl) 命令取消该 DDL Job。 | ||
|
|
||
| ## 执行回退操作 | ||
|
|
||
| 1. 以使用 TiDB Operator 从 v7.5.1 回退到 v7.5.0 版本为例,请严格按如下顺序执行回退操作: | ||
|
|
||
| ```shell | ||
| pd-ctl pd config set cluster-version "v7.5.0" -u \"pd-1-peer:2379\" | ||
| use kubectl edit tc/tc ticdc version to v7.5.0 | ||
| use kubectl edit tc/tc tidb version to v7.5.0 | ||
| use kubectl edit tc/tc tikv version to v7.5.0 | ||
| use kubectl edit tc/tc tiflash version to v7.5.0 | ||
| use kubectl edit tc/tc pd version to v7.5.0 | ||
| ``` | ||
|
|
||
| 2. 查看回退进度: | ||
|
|
||
| ```shell | ||
| watch kubectl -n ${namespace} get pod -o wide | ||
| ``` | ||
|
|
||
| 3. 当所有 Pod 都重建完毕进入 `Running` 状态后,回退完成。 | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.