Skip to content

Commit

Permalink
zh: update disaster recovery doc (pingcap#341)
Browse files Browse the repository at this point in the history
* update disaster recovery doc

* fix conflict
  • Loading branch information
DanielZhangQD authored Jun 5, 2020
1 parent df0be32 commit bf0f086
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 14 deletions.
6 changes: 4 additions & 2 deletions zh/TOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@
- [重启 TiDB 集群](restart-a-tidb-cluster.md)
- [维护 TiDB 集群所在节点](maintain-a-kubernetes-node.md)
- [查看日志](view-logs.md)
- [集群故障自动转移](use-auto-failover.md)
- [恢复 PD 集群](pd-recover.md)
- [集群故障自动转移](use-auto-failover.md)
- [销毁 TiDB 集群](destroy-a-tidb-cluster.md)
+ 灾难恢复
- [恢复 PD 集群](pd-recover.md)
- [恢复误删的集群](recover-deleted-cluster.md)
- [导入集群数据](restore-data-using-tidb-lightning.md)
- [故障诊断](troubleshoot.md)
- [常见问题](faq.md)
Expand Down
33 changes: 33 additions & 0 deletions zh/recover-deleted-cluster.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
title: 恢复误删的 TiDB 集群
summary: 介绍如何恢复误删的 TiDB 集群。
category: how-to
---

# 恢复误删的 TiDB 集群

本文介绍了如何恢复误删的 TiDB 集群。

## TidbCluster 管理的集群意外删除后恢复

TiDB Operator 使用 PV (Persistent Volume)、PVC (Persistent Volume Claim) 来存储持久化的数据,如果不小心使用 `kubectl delete tc` 意外删除了集群,PV/PVC 对象以及数据都会保留下来,以最大程度保证数据安全。

此时集群恢复的办法就是使用 `kubectl create` 命令来创建一个同名同配置的集群,之前保留下来未被删除的 PV/PVC 以及数据会被复用:

{{< copyable "shell-regular" >}}

```shell
kubectl -n ${namespace} create -f tidb-cluster.yaml
```

## Helm 管理的集群意外删除后恢复

TiDB Operator 使用 PV (Persistent Volume)、PVC (Persistent Volume Claim) 来存储持久化的数据,如果不小心使用 `helm delete` 意外删除了集群,PV/PVC 对象以及数据都会保留下来,以最大程度保证数据安全。

此时集群恢复的办法就是使用 `helm install` 命令来创建一个同名同配置的集群,之前保留下来未被删除的 PV/PVC 以及数据会被复用:

{{< copyable "shell-regular" >}}

```shell
helm install pingcap/tidb-cluster -n ${release_name} --namespace=${namespace} --version=${chart_version} -f values.yaml
```
12 changes: 0 additions & 12 deletions zh/troubleshoot.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,6 @@ kubectl delete pod ${pod_name} -n ${namespace}

Pod 重建后会自动回到正常运行模式。

## Helm 管理的集群意外删除后恢复

TiDB Operator 使用 PV (Persistent Volume)、PVC (Persistent Volume Claim) 来存储持久化的数据,如果不小心使用 `helm delete` 意外删除了集群,PV/PVC 对象以及数据都会保留下来,以最大程度保证数据安全。

此时集群恢复的办法就是使用 `helm install` 命令来创建一个同名的集群,之前保留下来未被删除的 PV/PVC 以及数据会被复用:

{{< copyable "shell-regular" >}}

```shell
helm install pingcap/tidb-cluster -n ${release_name} --namespace=${namespace} --version=${chart_version} -f values.yaml
```

## Pod 未正常创建

通过 `helm install` 创建集群后,如果 Pod 没有创建,则可以通过以下方式进行诊断:
Expand Down

0 comments on commit bf0f086

Please sign in to comment.