File tree Expand file tree Collapse file tree 2 files changed +70
-0
lines changed
Expand file tree Collapse file tree 2 files changed +70
-0
lines changed Original file line number Diff line number Diff line change 2222 - 运维
2323 - [ 查看 TiDB 日志] ( view-logs.md )
2424 - [ 销毁 TiDB 集群] ( destroy-a-tidb-cluster.md )
25+ - [ 挂起 TiDB 集群] ( suspend-tidb-cluster.md )
2526 - 为 TiDB 集群更换节点
2627 - 灾难恢复
2728- 故障诊断
Original file line number Diff line number Diff line change 1+ ---
2+ title : 挂起 TiDB 集群
3+ summary : 了解如何通过配置挂起 Kubernetes 上的 TiDB 集群。
4+ ---
5+
6+ # 挂起 TiDB 集群
7+
8+ 本文介绍如何通过配置 ` Cluster ` 对象来挂起 Kubernetes 上的 TiDB 集群。挂起集群会停止所有组件的 Pod,保留 ` Cluster ` 对象以及其他资源(例如 Service、PVC 等)。
9+
10+ ## 使用场景
11+
12+ 挂起 TiDB 集群适用于以下场景:
13+ - 测试环境中需要临时释放计算资源
14+ - 长期不使用的开发集群
15+ - 需要临时停止集群但保留数据和配置
16+
17+ ## 注意事项
18+ - 挂起操作会导致集群服务中断
19+ - 已有的连接会被强制断开
20+ - PVC 和数据仍然会占用存储空间
21+ - 集群相关的 Service 和配置保持不变
22+
23+ ## 配置挂起 TiDB 集群
24+
25+ 如果你需要挂起 TiDB 集群,执行以下步骤:
26+
27+ 1 . 在 ` Cluster ` 对象中,配置 ` spec.suspendAction ` 字段,挂起整个 TiDB 集群:
28+
29+ ``` yaml
30+ apiVersion : core.pingcap.com/v1alpha1
31+ kind : Cluster
32+ metadata :
33+ name : ${cluster_name}
34+ namespace : ${namespace}
35+ spec :
36+ suspendAction :
37+ suspendCompute : true
38+ # ...
39+ ```
40+
41+ 2. 挂起 TiDB 集群后,通过以下命令观察到 TiDB 集群的 Pod 逐步被删除:
42+
43+ ` ` ` shell
44+ kubectl -n ${namespace} get pods -w
45+ ` ` `
46+
47+ # # 恢复 TiDB 集群
48+
49+ 在 TiDB 集群被挂起后,如果需要恢复 TiDB 集群,执行以下步骤:
50+
51+ 1. 在 `Cluster` 对象中,配置 `spec.suspendAction` 字段,恢复被挂起的整个 TiDB 集群:
52+
53+ ` ` ` yaml
54+ apiVersion: core.pingcap.com/v1alpha1
55+ kind: Cluster
56+ metadata:
57+ name: ${cluster_name}
58+ namespace: ${namespace}
59+ spec:
60+ suspendAction:
61+ suspendCompute: false
62+ # ...
63+ ` ` `
64+
65+ 2. 恢复 TiDB 集群后,通过以下命令观察到 TiDB 集群的 Pod 逐步被创建:
66+
67+ ` ` ` shell
68+ kubectl -n ${namespace} get pods -w
69+ ` ` `
You can’t perform that action at this time.
0 commit comments