From c4ba157bdda0c676d9659f069499c33c5c9e65a0 Mon Sep 17 00:00:00 2001 From: yikeke Date: Thu, 2 Aug 2018 13:52:05 +0800 Subject: [PATCH 1/2] tools, readme: add pd recover usage document Via: https://github.com/pingcap/docs-cn/pull/818/ --- README.md | 1 + tools/pd-recover.md | 50 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 tools/pd-recover.md diff --git a/README.md b/README.md index 7810502a71a9b..5810425224628 100644 --- a/README.md +++ b/README.md @@ -112,6 +112,7 @@ - [Loader](tools/loader.md) - [TiDB-Binlog](tools/tidb-binlog-kafka.md) - [PD Control](tools/pd-control.md) + - [PD Recover](tools/pd-recover.md) - [TiKV Control](tools/tikv-control.md) - [TiDB Controller](tools/tidb-controller.md) + TiKV Documentation diff --git a/tools/pd-recover.md b/tools/pd-recover.md new file mode 100644 index 0000000000000..8a1d8c1a09696 --- /dev/null +++ b/tools/pd-recover.md @@ -0,0 +1,50 @@ +--- + title: PD Recover User Guide + summary: Use PD Recover to recover a PD cluster which cannot start or provide services normally. + category: tools + --- + + # PD Recover User Guide + + As a disaster recovery tool of PD, PD Recover recovers the PD cluster which cannot start or provide services normally. + + ## Source code compiling + +1. [Go](https://golang.org/) Version 1.9 or later +2. In the PD root directory, use the `make` command to compile and generate `bin/pd-recover` + + ## Usage + + ### Flags description + + ``` + -alloc-id uint + Specify a number larger than the allocated ID of the original cluster + + -cacert string + Specify the path to the trusted CA certificate file in PEM format + + -cert string + Specify the path to the SSL certificate file in PEM format + + -key string + Specify the path to the SSL certificate key file in PEM format, which is the private key of the certificate specified by `--cert` + + -cluster-id uint + Specify the Cluster ID of the original cluster + + -endpoints string + Specify the PD address (default:"http://127.0.0.1:2379") + ``` + + ### Recovery flow + + 1. Obtain the Cluster ID and the Alloc ID from the current cluster. + + Generally, you can obtain the Cluster ID from the PD, TiKV and TiDB log and the allocated Alloc ID from either the PD log or the `Metadata Information` in the PD monitoring panel. + + Specifying `alloc-id` requires a number larger than the current largest Alloc ID. If you fail to obtain the Alloc ID, you can make an estimate of a larger number according to the number of Regions and Stores in the cluster. Normally, you can specify a number that is several orders of magnitude larger. + + 2. Stop the whole cluster, clear the PD data directory, and restart the PD cluster. + 3. Use PD Recover to recover and make sure that you use the right `cluster-id` and `alloc-id`. + 4. When the recovery success information is prompted, restart the whole cluster. From 2f65a336a746692d3011ea81a62df0a49e663124 Mon Sep 17 00:00:00 2001 From: yikeke Date: Thu, 2 Aug 2018 17:29:23 +0800 Subject: [PATCH 2/2] tools: address comment --- tools/pd-control.md | 2 +- tools/pd-recover.md | 69 ++++++++++++++++++++++----------------------- 2 files changed, 34 insertions(+), 37 deletions(-) diff --git a/tools/pd-control.md b/tools/pd-control.md index aba84e01ffeb4..a7ff534bf40e5 100644 --- a/tools/pd-control.md +++ b/tools/pd-control.md @@ -11,7 +11,7 @@ As a command line tool of PD, PD Control obtains the state information of the cl ## Source code compiling 1. [Go](https://golang.org/) Version 1.9 or later -2. In the PD root directory, use the `make` command to compile and generate `bin/pd-ctl` +2. In the root directory of the [PD project](https://github.com/pingcap/pd), use the `make` command to compile and generate `bin/pd-ctl` > **Note:** Generally, you don't need to compile source code as the PD Control tool already exists in the released Binary or Docker. However, dev users can refer to the above instruction for compiling source code. diff --git a/tools/pd-recover.md b/tools/pd-recover.md index 8a1d8c1a09696..0b24dec7837e6 100644 --- a/tools/pd-recover.md +++ b/tools/pd-recover.md @@ -1,50 +1,47 @@ --- - title: PD Recover User Guide - summary: Use PD Recover to recover a PD cluster which cannot start or provide services normally. - category: tools - --- +title: PD Recover User Guide +summary: Use PD Recover to recover a PD cluster which cannot start or provide services normally. +category: tools +--- - # PD Recover User Guide +# PD Recover User Guide - As a disaster recovery tool of PD, PD Recover recovers the PD cluster which cannot start or provide services normally. +PD Recover is a disaster recovery tool of PD, used to recover the PD cluster which cannot start or provide services normally. - ## Source code compiling +## Source code compiling 1. [Go](https://golang.org/) Version 1.9 or later -2. In the PD root directory, use the `make` command to compile and generate `bin/pd-recover` - - ## Usage - - ### Flags description +2. In the root directory of the [PD project](https://github.com/pingcap/pd), use the `make` command to compile and generate `bin/pd-recover` - ``` - -alloc-id uint - Specify a number larger than the allocated ID of the original cluster +## Usage - -cacert string - Specify the path to the trusted CA certificate file in PEM format +This section describes how to recover a PD cluster which cannot start or provide services normally. - -cert string - Specify the path to the SSL certificate file in PEM format +### Flags description - -key string - Specify the path to the SSL certificate key file in PEM format, which is the private key of the certificate specified by `--cert` +``` +-alloc-id uint + Specify a number larger than the allocated ID of the original cluster +-cacert string + Specify the path to the trusted CA certificate file in PEM format +-cert string + Specify the path to the SSL certificate file in PEM format +-key string + Specify the path to the SSL certificate key file in PEM format, which is the private key of the certificate specified by `--cert` +-cluster-id uint + Specify the Cluster ID of the original cluster +-endpoints string + Specify the PD address (default: "http://127.0.0.1:2379") +``` - -cluster-id uint - Specify the Cluster ID of the original cluster +### Recovery flow - -endpoints string - Specify the PD address (default:"http://127.0.0.1:2379") - ``` - - ### Recovery flow - - 1. Obtain the Cluster ID and the Alloc ID from the current cluster. +1. Obtain the Cluster ID and the Alloc ID from the current cluster. - Generally, you can obtain the Cluster ID from the PD, TiKV and TiDB log and the allocated Alloc ID from either the PD log or the `Metadata Information` in the PD monitoring panel. + - Obtain the Cluster ID from the PD, TiKV and TiDB log. + - Obtain the allocated Alloc ID from either the PD log or the `Metadata Information` in the PD monitoring panel. - Specifying `alloc-id` requires a number larger than the current largest Alloc ID. If you fail to obtain the Alloc ID, you can make an estimate of a larger number according to the number of Regions and Stores in the cluster. Normally, you can specify a number that is several orders of magnitude larger. - - 2. Stop the whole cluster, clear the PD data directory, and restart the PD cluster. - 3. Use PD Recover to recover and make sure that you use the right `cluster-id` and `alloc-id`. - 4. When the recovery success information is prompted, restart the whole cluster. + Specifying `alloc-id` requires a number larger than the current largest Alloc ID. If you fail to obtain the Alloc ID, you can make an estimate of a larger number according to the number of Regions and Stores in the cluster. Generally, you can specify a number that is several orders of magnitude larger. +2. Stop the whole cluster, clear the PD data directory, and restart the PD cluster. +3. Use PD Recover to recover and make sure that you use the correct `cluster-id` and appropriate `alloc-id`. +4. When the recovery success information is prompted, restart the whole cluster.