From 3b88faf7ebb5ff2bf2601683c62abb3484bd522b Mon Sep 17 00:00:00 2001 From: Ran Date: Fri, 10 Apr 2020 14:07:58 +0800 Subject: [PATCH 1/5] how-to: add doc on how to scale with TiUP --- TOC.md | 3 +- how-to/scale/with-tiup.md | 229 ++++++++++++++++++++++++++++++++++ reference/tiflash/deploy.md | 2 +- reference/tiflash/maintain.md | 2 +- reference/tiflash/scale.md | 72 ----------- 5 files changed, 233 insertions(+), 75 deletions(-) create mode 100644 how-to/scale/with-tiup.md delete mode 100644 reference/tiflash/scale.md diff --git a/TOC.md b/TOC.md index dbad43bbd7458..310b1978cc473 100644 --- a/TOC.md +++ b/TOC.md @@ -89,6 +89,7 @@ - [Identify Expensive Queries](/how-to/maintain/identify-abnormal-queries/identify-expensive-queries.md) + Scale - [Scale using Ansible](/how-to/scale/with-ansible.md) + - [Scale using TiUP](/how-to/scale/with-tiup.md) - [Scale a TiDB Cluster](/how-to/scale/horizontally.md) + Upgrade - [Upgrade to the Latest Version](/how-to/upgrade/from-previous-version.md) @@ -314,7 +315,7 @@ - [Use TiFlash](/reference/tiflash/use-tiflash.md) - [Maintain a TiFlash Cluster](/reference/tiflash/maintain.md) - [Monitor TiFlash](/reference/tiflash/monitor.md) - - [Scale TiFlash](/reference/tiflash/scale.md) + - [Scale TiFlash](/how-to/scale/with-tiup.md#2-scale-out-a-tiflash-node) - [Upgrade TiFlash Nodes](/reference/tiflash/upgrade.md) - [Configure TiFlash](/reference/tiflash/configuration.md) - [Tune TiFlash Performance](/reference/tiflash/tune-performance.md) diff --git a/how-to/scale/with-tiup.md b/how-to/scale/with-tiup.md new file mode 100644 index 0000000000000..b7673129cd233 --- /dev/null +++ b/how-to/scale/with-tiup.md @@ -0,0 +1,229 @@ +--- +title: Scale the TiDB Cluster Using TiUP +summary: +Category: how-to +--- + +# Scale the TiDB Cluster Using TiUP + +The capacity of a TiDB cluster can be increased or decreased without affecting the online services. + +This document describes how to scale the TiDB, TiKV, PD or TiFlash nodes using TiUP. If you have not installed TiUP, [install TiUP on the Control Machine](/how-to/upgrade/using-tiup.md#2-install-tiup-on-the-control-machine) and import the cluster into TiUP before you scale the TiDB cluster. + +To view the current cluster name list, run `tiup cluster list`. + +The following example shows the original topology of the cluster: + +| Host IP | Service | +|:---|:----| +| 10.0.1.3 | TiDB + TiFlash | +| 10.0.1.4 | TiDB + PD | +| 10.0.1.5 | TiKV + Monitor | +| 10.0.1.1 | TiKV | +| 10.0.1.2 | TiKV | + +## 1. Scale out a TiDB/TiKV/PD node + +If you want to add a TiDB node to the `10.0.1.5` host, take the following steps. + +> **Note:** +> +> You can take similar steps to add the TiKV or PD node. + +### 1.1 Configure the scale-out topology + +> **Note:** +> +> * The port information is not required by default. +> * If the cluster is deployed on a single machine with multiple instances, you need to allocate different ports. If the ports or directories have conflicts, a notification is sent to you during deployment or scaling. + +Add the scale-out topology configuration in the `scale-out.yaml` file: + +{{< copyable "shell-regular" >}} + +```shell +vi scale-out.yaml +``` + +``` +tidb_servers: + - host: 10.0.1.5 + ssh_port: 22 + port: 4000 + status_port: 10080 +``` + +To view the whole configuration of the current cluster, run `tiup cluster edit-config `. The global configuration in `global` and `server_configs` also takes effect in `scale-out.yaml`. + +After the configuration, the current topology of the cluster is as follows: + +| Host IP | Service | +|:---|:----| +| 10.0.1.3 | TiDB + TiFlash | +| 10.0.1.4 | TiDB + PD | +| 10.0.1.5 | **TiDB** + TiKV + Monitor | +| 10.0.1.1 | TiKV | +| 10.0.1.2 | TiKV | + +### 1.2 Run the scale-out command + +{{< copyable "shell-regular" >}} + +```shell +tiup cluster scale-out scale-out.yaml +``` + +If you see the `Scaled cluster out successfully`, the scale-out operation is successfully completed. + +### 1.3 Check the cluster status + +{{< copyable "shell-regular" >}} + +```shell +tiup cluster display +``` + +Access the monitoring platform at using your browser to monitor the status of the cluster and the new node. + +## 2. Scale out a TiFlash node + +If you want to add a TiFlash node to the `10.0.1.4` host, take the following steps. + +### 2.1 Add the node information to the `scale-out.yaml` file + +Create the `scale-out.yaml` file to add the TiFlash node information. + +{{< copyable "" >}} + +```ini +tiflash_servers: + - host: 10.0.1.4 +``` + +Currently, you can only add IP but not domain name. + +### 2.2 Run the scale-out command + +{{< copyable "shell-regular" >}} + +```shell +tiup cluster scale-out scale-out.yaml +``` + +### 2.3 View the cluster status + +{{< copyable "shell-regular" >}} + +```shell +tiup cluster display +``` + +Access the monitoring platform at using your browser, and view the status of the cluster and the new node. + +## 3. Scale in a TiDB/TiKV/PD node + +If you want to remove a TiKV node from the `10.0.1.5` host, take the following steps. + +> **Note:** +> +> You can take similar steps to remove the TiDB or PD node. + +### 3.1 View the node ID information + +{{< copyable "shell-regular" >}} + +```shell +tiup cluster display +``` + +``` +Starting /root/.tiup/components/cluster/v0.4.6/cluster display +TiDB Cluster: +TiDB Version: v4.0.0-rc +ID Role Host Ports Status Data Dir Deploy Dir +-- ---- ---- ----- ------ -------- ---------- +10.0.1.4:2379 pd 10.0.1.4 2379/2380 Healthy data/pd-2379 deploy/pd-2379 +10.0.1.1:20160 tikv 10.0.1.1 20160/20180 Up data/tikv-20160 deploy/tikv-20160 +10.0.1.2:20160 tikv 10.0.1.2 20160/20180 Up data/tikv-20160 deploy/tikv-20160 +10.0.1.5:20160 tikv 10.0.1.5 20160/20180 Up data/tikv-20160 deploy/tikv-20160 +10.0.1.3:4000 tidb 10.0.1.3 4000/10080 Up - deploy/tidb-4000 +10.0.1.4:4000 tidb 10.0.1.4 4000/10080 Up - deploy/tidb-4000 +10.0.1.5:4000 tidb 10.0.1.5 4000/10080 Up - deploy/tidb-4000 +10.0.1.3:9000 tiflash 10.0.1.3 9000/8123/3930/20170/20292/8234 Up data/tiflash-9000 deploy/tiflash-9000 +10.0.1.4:9000 tiflash 10.0.1.4 9000/8123/3930/20170/20292/8234 Up data/tiflash-9000 deploy/tiflash-9000 +10.0.1.5:9290 prometheus 10.0.1.5 9290 Up data/prometheus-9290 deploy/prometheus-9290 +10.0.1.5:3200 grafana 10.0.1.5 3200 Up - deploy/grafana-3200 +10.0.1.5:9293 alertmanager 10.0.1.5 9293/9294 Up data/alertmanager-9293 deploy/alertmanager-9293 +``` + +### 3.2 Run the scale-in + +{{< copyable "shell-regular" >}} + +```shell +tiup cluster scale-in --node 10.0.1.5:20160 +``` + +The `--node` parameter is the ID of the node to be taken offline. + +If you see the `Scaled cluster in successfully`, the scale-in operation is successfully completed. + +### 3.3 Check the cluster status + +The offline process takes some time. If the node to be scaled in becomes `Tombstone`, that means the offline operation is successful. + +To check the offline status, run the following command: + +{{< copyable "shell-regular" >}} + +```shell +tiup cluster display +``` + +The current topology is as follows: + +| Host IP | Service | +|:----|:----| +| 10.0.1.3 | TiDB + TiFlash | +| 10.0.1.4 | TiDB + PD + TiFlash | +| 10.0.1.5 | TiDB + Monitor **(TiKV is deleted)** | +| 10.0.1.1 | TiKV | +| 10.0.1.2 | TiKV | + +Access the monitoring platform at using your browser to monitor the status of the cluster. + +## 4. Scale in a TiFlash node + +If you want to remove the TiFlash node from the `10.0.1.4` host, take the following steps. + +> **Note:** +> +> The offline process described in this section does not delete the data on the offline node. If you need to take the node online again, delete the data manually. + +### 4.1 Take the node offline + +Take down the node to be scaled in. See [Take a TiFlash node down](/reference/tiflash/maintain.md#take-a-tiflash-node-down) for details. + +### 4.2 Check the node status + +Check whether the node has been offline successfully using Grafana or pd-ctl (the offline process takes some time). + +### 4.3 Shutdown the TiFlash process + +After the `store` corresponding to TiFlash disappears, or the `state_name` becomes `Tombstone`, execute the following command to shutdown the TiFlash process: + +{{< copyable "shell-regular" >}} + +```shell +tiup cluster scale-in --node 10.0.1.4:9000 +``` + +### 4.4 View the cluster status + +{{< copyable "shell-regular" >}} + +```shell +tiup cluster display +``` + +Access the monitoring platform at using your browser, and view the status of the cluster. diff --git a/reference/tiflash/deploy.md b/reference/tiflash/deploy.md index 1ae6a35a3ef31..837d53a6ed842 100644 --- a/reference/tiflash/deploy.md +++ b/reference/tiflash/deploy.md @@ -141,4 +141,4 @@ TiUP cluster is the deployment tool for TiDB 4.0 or later versions. It is recomm Currently, pd-ctl is not connected to TiUP cluster, you need to [manually download pd-ctl](https://download.pingcap.org/tidb-v4.0.0-rc-linux-amd64.tar.gz). -3. Refer to [Scale out a TiFlash node](/reference/tiflash/scale.md#scale-out-a-tiflash-node) and deploy TiFlash. +3. Refer to [Scale out a TiFlash node](/how-to/scale/with-tiup.md#2-scale-out-a-tiflash-node) and deploy TiFlash. diff --git a/reference/tiflash/maintain.md b/reference/tiflash/maintain.md index 60b582e742f4a..533923e18681e 100644 --- a/reference/tiflash/maintain.md +++ b/reference/tiflash/maintain.md @@ -32,7 +32,7 @@ There are two ways to check the TiFlash version: ## Take a TiFlash node down -Taking a TiFlash node down differs from [Scaling in a TiFlash node](/reference/tiflash/scale.md#scale-in-a-tiflash-node) in that the former doesn't remove the node in TiDB Ansible; instead, it just safely shuts down the TiFlash process. +Taking a TiFlash node down differs from [Scaling in a TiFlash node](/how-to/scale/with-tiup.md#scale-in-a-tiflash-node) in that the former doesn't remove the node in TiDB Ansible; instead, it just safely shuts down the TiFlash process. Follow the steps below to take a TiFlash node down: diff --git a/reference/tiflash/scale.md b/reference/tiflash/scale.md deleted file mode 100644 index f1fc3e79bc547..0000000000000 --- a/reference/tiflash/scale.md +++ /dev/null @@ -1,72 +0,0 @@ ---- -title: Scale the TiFlash Cluster -summary: Learn how to scale in and out nodes in the TiFlash cluster. -category: reference ---- - -# Scale the TiFlash Cluster - -This document describes how to scale in and out nodes in the TiFlash cluster. - -## Scale out a TiFlash node - -If you need to add a TiFlash node to the `172.19.0.104` host, take the following steps: - -1. Create the `scale-out.yaml` file to add the TiFlash node information: - - Currently, you can only add IP but not domain name. - - {{< copyable "" >}} - - ```ini - tiflash_servers: - - host: 172.19.0.104 - ``` - -2. Run the scale-out command: - - {{< copyable "shell-regular" >}} - - ```shell - tiup cluster scale-out test scale-out.yaml - ``` - -3. View the cluster status: - - {{< copyable "shell-regular" >}} - - ```shell - tiup cluster display test - ``` - -4. Access the monitoring platform using your browser, and view the status of the cluster and the new node. - -## Scale in a TiFlash node - -If you want to stop the TiFlash service on the `172.19.0.104` node, take the following steps: - -> **Note:** -> -> The offline process described in this section does not delete the data on the offline node. If you need to take the node online again, delete the data manually. - -1. Take down the node to be scaled in. See [Take a TiFlash node down](/reference/tiflash/maintain.md#take-a-tiflash-node-down) for details. - -2. Check whether the node has been offline successfully using Grafana or pd-ctl (the offline process takes some time). - -3. After the `store` corresponding to TiFlash disappears, or the `state_name` becomes `Tombstone`, execute the following command to shutdown the TiFlash process: - - {{< copyable "shell-regular" >}} - - ```shell - tiup cluster scale-in test --node 172.19.0.104:9000 - ``` - -4. View the cluster status: - - {{< copyable "shell-regular" >}} - - ```shell - tiup cluster display test - ``` - -5. Access the monitoring platform using your browser, and view the status of the cluster. From 68f9d7859e6e4021a8497576fcc1e108593f94c0 Mon Sep 17 00:00:00 2001 From: Ran Date: Fri, 10 Apr 2020 15:21:33 +0800 Subject: [PATCH 2/5] update anchor --- how-to/scale/with-tiup.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/how-to/scale/with-tiup.md b/how-to/scale/with-tiup.md index b7673129cd233..1b8efd78d8cf9 100644 --- a/how-to/scale/with-tiup.md +++ b/how-to/scale/with-tiup.md @@ -8,7 +8,7 @@ Category: how-to The capacity of a TiDB cluster can be increased or decreased without affecting the online services. -This document describes how to scale the TiDB, TiKV, PD or TiFlash nodes using TiUP. If you have not installed TiUP, [install TiUP on the Control Machine](/how-to/upgrade/using-tiup.md#2-install-tiup-on-the-control-machine) and import the cluster into TiUP before you scale the TiDB cluster. +This document describes how to scale the TiDB, TiKV, PD or TiFlash nodes using TiUP. If you have not installed TiUP, [install TiUP on the Control Machine](/how-to/upgrade/using-tiup.md#install-tiup-on-the-control-machine) and import the cluster into TiUP before you scale the TiDB cluster. To view the current cluster name list, run `tiup cluster list`. From 9ec37fb7c2c8da30216eb156d4276c79c68f921e Mon Sep 17 00:00:00 2001 From: Ran Date: Sat, 11 Apr 2020 13:15:31 +0800 Subject: [PATCH 3/5] Apply suggestions from code review Co-Authored-By: Keke Yi <40977455+yikeke@users.noreply.github.com> --- how-to/scale/with-tiup.md | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/how-to/scale/with-tiup.md b/how-to/scale/with-tiup.md index 1b8efd78d8cf9..cdc02e2cff2e4 100644 --- a/how-to/scale/with-tiup.md +++ b/how-to/scale/with-tiup.md @@ -8,11 +8,11 @@ Category: how-to The capacity of a TiDB cluster can be increased or decreased without affecting the online services. -This document describes how to scale the TiDB, TiKV, PD or TiFlash nodes using TiUP. If you have not installed TiUP, [install TiUP on the Control Machine](/how-to/upgrade/using-tiup.md#install-tiup-on-the-control-machine) and import the cluster into TiUP before you scale the TiDB cluster. +This document describes how to scale the TiDB, TiKV, PD or TiFlash nodes using TiUP. If you have not installed TiUP, refer to the steps in [Install TiUP on the Control Machine](/how-to/upgrade/using-tiup.md#install-tiup-on-the-control-machine) and import the cluster into TiUP before you scale the TiDB cluster. To view the current cluster name list, run `tiup cluster list`. -The following example shows the original topology of the cluster: +For example, if the original topology of the cluster is as follows: | Host IP | Service | |:---|:----| @@ -35,7 +35,7 @@ If you want to add a TiDB node to the `10.0.1.5` host, take the following steps. > **Note:** > > * The port information is not required by default. -> * If the cluster is deployed on a single machine with multiple instances, you need to allocate different ports. If the ports or directories have conflicts, a notification is sent to you during deployment or scaling. +> * If multiple instances are deployed on a single machine, you need to allocate different ports for them. If the ports or directories have conflicts, you will receive a notification during deployment or scaling. Add the scale-out topology configuration in the `scale-out.yaml` file: @@ -53,7 +53,7 @@ tidb_servers: status_port: 10080 ``` -To view the whole configuration of the current cluster, run `tiup cluster edit-config `. The global configuration in `global` and `server_configs` also takes effect in `scale-out.yaml`. +To view the whole configuration of the current cluster, run `tiup cluster edit-config `. The global configuration of `global` and `server_configs` also takes effect in `scale-out.yaml`. After the configuration, the current topology of the cluster is as follows: @@ -156,7 +156,7 @@ ID Role Host Ports Status 10.0.1.5:9293 alertmanager 10.0.1.5 9293/9294 Up data/alertmanager-9293 deploy/alertmanager-9293 ``` -### 3.2 Run the scale-in +### 3.2 Run the scale-in command {{< copyable "shell-regular" >}} @@ -170,9 +170,9 @@ If you see the `Scaled cluster in successfully`, the scale-in ope ### 3.3 Check the cluster status -The offline process takes some time. If the node to be scaled in becomes `Tombstone`, that means the offline operation is successful. +The scale-in process takes some time. If the status of the node to be scaled in becomes `Tombstone`, that means the scale-in operation is successful. -To check the offline status, run the following command: +To check the scale-in status, run the following command: {{< copyable "shell-regular" >}} @@ -198,19 +198,21 @@ If you want to remove the TiFlash node from the `10.0.1.4` host, take the follow > **Note:** > -> The offline process described in this section does not delete the data on the offline node. If you need to take the node online again, delete the data manually. +> The scale-in process described in this section does not delete the data on the node that goes offline. If you need to bring the node back again, delete the data manually. ### 4.1 Take the node offline -Take down the node to be scaled in. See [Take a TiFlash node down](/reference/tiflash/maintain.md#take-a-tiflash-node-down) for details. +To take offline the node to be scaled in, refer to [Take a TiFlash node down](/reference/tiflash/maintain.md#take-a-tiflash-node-down). ### 4.2 Check the node status -Check whether the node has been offline successfully using Grafana or pd-ctl (the offline process takes some time). +The scale-in process takes some time. -### 4.3 Shutdown the TiFlash process +You can use Grafana or pd-ctl to check whether the node has been successfully taken offline. -After the `store` corresponding to TiFlash disappears, or the `state_name` becomes `Tombstone`, execute the following command to shutdown the TiFlash process: +### 4.3 Stop the TiFlash process + +After the `store` corresponding to TiFlash disappears, or the `state_name` becomes `Tombstone`, execute the following command to stop the TiFlash process: {{< copyable "shell-regular" >}} From 0c93e779fb03a4253c00fa77ea2acbf21fd48566 Mon Sep 17 00:00:00 2001 From: Ran Date: Sat, 11 Apr 2020 13:21:23 +0800 Subject: [PATCH 4/5] remove numbers in heading --- how-to/scale/with-tiup.md | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/how-to/scale/with-tiup.md b/how-to/scale/with-tiup.md index cdc02e2cff2e4..8ee7597a8a4cf 100644 --- a/how-to/scale/with-tiup.md +++ b/how-to/scale/with-tiup.md @@ -22,7 +22,7 @@ For example, if the original topology of the cluster is as follows: | 10.0.1.1 | TiKV | | 10.0.1.2 | TiKV | -## 1. Scale out a TiDB/TiKV/PD node +## Scale out a TiDB/TiKV/PD node If you want to add a TiDB node to the `10.0.1.5` host, take the following steps. @@ -30,7 +30,7 @@ If you want to add a TiDB node to the `10.0.1.5` host, take the following steps. > > You can take similar steps to add the TiKV or PD node. -### 1.1 Configure the scale-out topology +### Configure the scale-out topology > **Note:** > @@ -65,7 +65,7 @@ After the configuration, the current topology of the cluster is as follows: | 10.0.1.1 | TiKV | | 10.0.1.2 | TiKV | -### 1.2 Run the scale-out command +### Run the scale-out command {{< copyable "shell-regular" >}} @@ -75,7 +75,7 @@ tiup cluster scale-out scale-out.yaml If you see the `Scaled cluster out successfully`, the scale-out operation is successfully completed. -### 1.3 Check the cluster status +### Check the cluster status {{< copyable "shell-regular" >}} @@ -85,11 +85,11 @@ tiup cluster display Access the monitoring platform at using your browser to monitor the status of the cluster and the new node. -## 2. Scale out a TiFlash node +## Scale out a TiFlash node If you want to add a TiFlash node to the `10.0.1.4` host, take the following steps. -### 2.1 Add the node information to the `scale-out.yaml` file +### Add the node information to the `scale-out.yaml` file Create the `scale-out.yaml` file to add the TiFlash node information. @@ -102,7 +102,7 @@ tiflash_servers: Currently, you can only add IP but not domain name. -### 2.2 Run the scale-out command +### Run the scale-out command {{< copyable "shell-regular" >}} @@ -110,7 +110,7 @@ Currently, you can only add IP but not domain name. tiup cluster scale-out scale-out.yaml ``` -### 2.3 View the cluster status +### View the cluster status {{< copyable "shell-regular" >}} @@ -120,7 +120,7 @@ tiup cluster display Access the monitoring platform at using your browser, and view the status of the cluster and the new node. -## 3. Scale in a TiDB/TiKV/PD node +## Scale in a TiDB/TiKV/PD node If you want to remove a TiKV node from the `10.0.1.5` host, take the following steps. @@ -128,7 +128,7 @@ If you want to remove a TiKV node from the `10.0.1.5` host, take the following s > > You can take similar steps to remove the TiDB or PD node. -### 3.1 View the node ID information +### View the node ID information {{< copyable "shell-regular" >}} @@ -156,7 +156,7 @@ ID Role Host Ports Status 10.0.1.5:9293 alertmanager 10.0.1.5 9293/9294 Up data/alertmanager-9293 deploy/alertmanager-9293 ``` -### 3.2 Run the scale-in command +### Run the scale-in command {{< copyable "shell-regular" >}} @@ -168,7 +168,7 @@ The `--node` parameter is the ID of the node to be taken offline. If you see the `Scaled cluster in successfully`, the scale-in operation is successfully completed. -### 3.3 Check the cluster status +### Check the cluster status The scale-in process takes some time. If the status of the node to be scaled in becomes `Tombstone`, that means the scale-in operation is successful. @@ -192,7 +192,7 @@ The current topology is as follows: Access the monitoring platform at using your browser to monitor the status of the cluster. -## 4. Scale in a TiFlash node +## Scale in a TiFlash node If you want to remove the TiFlash node from the `10.0.1.4` host, take the following steps. @@ -200,17 +200,17 @@ If you want to remove the TiFlash node from the `10.0.1.4` host, take the follow > > The scale-in process described in this section does not delete the data on the node that goes offline. If you need to bring the node back again, delete the data manually. -### 4.1 Take the node offline +### Take the node offline To take offline the node to be scaled in, refer to [Take a TiFlash node down](/reference/tiflash/maintain.md#take-a-tiflash-node-down). -### 4.2 Check the node status +### Check the node status The scale-in process takes some time. You can use Grafana or pd-ctl to check whether the node has been successfully taken offline. -### 4.3 Stop the TiFlash process +### Stop the TiFlash process After the `store` corresponding to TiFlash disappears, or the `state_name` becomes `Tombstone`, execute the following command to stop the TiFlash process: @@ -220,7 +220,7 @@ After the `store` corresponding to TiFlash disappears, or the `state_name` becom tiup cluster scale-in --node 10.0.1.4:9000 ``` -### 4.4 View the cluster status +### View the cluster status {{< copyable "shell-regular" >}} From 692d68d20c28d8d660d5a28c7587539e94749975 Mon Sep 17 00:00:00 2001 From: Ran Date: Mon, 13 Apr 2020 13:17:34 +0800 Subject: [PATCH 5/5] update list format --- how-to/scale/with-tiup.md | 242 +++++++++++++++++++------------------- 1 file changed, 121 insertions(+), 121 deletions(-) diff --git a/how-to/scale/with-tiup.md b/how-to/scale/with-tiup.md index 8ee7597a8a4cf..6d4edaef1cfe0 100644 --- a/how-to/scale/with-tiup.md +++ b/how-to/scale/with-tiup.md @@ -30,95 +30,95 @@ If you want to add a TiDB node to the `10.0.1.5` host, take the following steps. > > You can take similar steps to add the TiKV or PD node. -### Configure the scale-out topology +1. Configure the scale-out topology: -> **Note:** -> -> * The port information is not required by default. -> * If multiple instances are deployed on a single machine, you need to allocate different ports for them. If the ports or directories have conflicts, you will receive a notification during deployment or scaling. + > **Note:** + > + > * The port information is not required by default. + > * If multiple instances are deployed on a single machine, you need to allocate different ports for them. If the ports or directories have conflicts, you will receive a notification during deployment or scaling. -Add the scale-out topology configuration in the `scale-out.yaml` file: + Add the scale-out topology configuration in the `scale-out.yaml` file: -{{< copyable "shell-regular" >}} + {{< copyable "shell-regular" >}} -```shell -vi scale-out.yaml -``` + ```shell + vi scale-out.yaml + ``` -``` -tidb_servers: - - host: 10.0.1.5 - ssh_port: 22 - port: 4000 - status_port: 10080 -``` + ``` + tidb_servers: + - host: 10.0.1.5 + ssh_port: 22 + port: 4000 + status_port: 10080 + ``` -To view the whole configuration of the current cluster, run `tiup cluster edit-config `. The global configuration of `global` and `server_configs` also takes effect in `scale-out.yaml`. + To view the whole configuration of the current cluster, run `tiup cluster edit-config `. The global configuration of `global` and `server_configs` also takes effect in `scale-out.yaml`. -After the configuration, the current topology of the cluster is as follows: + After the configuration, the current topology of the cluster is as follows: -| Host IP | Service | -|:---|:----| -| 10.0.1.3 | TiDB + TiFlash | -| 10.0.1.4 | TiDB + PD | -| 10.0.1.5 | **TiDB** + TiKV + Monitor | -| 10.0.1.1 | TiKV | -| 10.0.1.2 | TiKV | + | Host IP | Service | + |:---|:----| + | 10.0.1.3 | TiDB + TiFlash | + | 10.0.1.4 | TiDB + PD | + | 10.0.1.5 | **TiDB** + TiKV + Monitor | + | 10.0.1.1 | TiKV | + | 10.0.1.2 | TiKV | -### Run the scale-out command +2. Run the scale-out command: -{{< copyable "shell-regular" >}} + {{< copyable "shell-regular" >}} -```shell -tiup cluster scale-out scale-out.yaml -``` + ```shell + tiup cluster scale-out scale-out.yaml + ``` -If you see the `Scaled cluster out successfully`, the scale-out operation is successfully completed. + If you see the `Scaled cluster out successfully`, the scale-out operation is successfully completed. -### Check the cluster status +3. Check the cluster status: -{{< copyable "shell-regular" >}} + {{< copyable "shell-regular" >}} -```shell -tiup cluster display -``` + ```shell + tiup cluster display + ``` -Access the monitoring platform at using your browser to monitor the status of the cluster and the new node. + Access the monitoring platform at using your browser to monitor the status of the cluster and the new node. ## Scale out a TiFlash node If you want to add a TiFlash node to the `10.0.1.4` host, take the following steps. -### Add the node information to the `scale-out.yaml` file +1. Add the node information to the `scale-out.yaml` file: -Create the `scale-out.yaml` file to add the TiFlash node information. + Create the `scale-out.yaml` file to add the TiFlash node information. -{{< copyable "" >}} + {{< copyable "" >}} -```ini -tiflash_servers: - - host: 10.0.1.4 -``` + ```ini + tiflash_servers: + - host: 10.0.1.4 + ``` -Currently, you can only add IP but not domain name. + Currently, you can only add IP but not domain name. -### Run the scale-out command +2. Run the scale-out command: -{{< copyable "shell-regular" >}} + {{< copyable "shell-regular" >}} -```shell -tiup cluster scale-out scale-out.yaml -``` + ```shell + tiup cluster scale-out scale-out.yaml + ``` -### View the cluster status +3. View the cluster status: -{{< copyable "shell-regular" >}} + {{< copyable "shell-regular" >}} -```shell -tiup cluster display -``` + ```shell + tiup cluster display + ``` -Access the monitoring platform at using your browser, and view the status of the cluster and the new node. + Access the monitoring platform at using your browser, and view the status of the cluster and the new node. ## Scale in a TiDB/TiKV/PD node @@ -128,69 +128,69 @@ If you want to remove a TiKV node from the `10.0.1.5` host, take the following s > > You can take similar steps to remove the TiDB or PD node. -### View the node ID information +1. View the node ID information: -{{< copyable "shell-regular" >}} + {{< copyable "shell-regular" >}} -```shell -tiup cluster display -``` + ```shell + tiup cluster display + ``` -``` -Starting /root/.tiup/components/cluster/v0.4.6/cluster display -TiDB Cluster: -TiDB Version: v4.0.0-rc -ID Role Host Ports Status Data Dir Deploy Dir --- ---- ---- ----- ------ -------- ---------- -10.0.1.4:2379 pd 10.0.1.4 2379/2380 Healthy data/pd-2379 deploy/pd-2379 -10.0.1.1:20160 tikv 10.0.1.1 20160/20180 Up data/tikv-20160 deploy/tikv-20160 -10.0.1.2:20160 tikv 10.0.1.2 20160/20180 Up data/tikv-20160 deploy/tikv-20160 -10.0.1.5:20160 tikv 10.0.1.5 20160/20180 Up data/tikv-20160 deploy/tikv-20160 -10.0.1.3:4000 tidb 10.0.1.3 4000/10080 Up - deploy/tidb-4000 -10.0.1.4:4000 tidb 10.0.1.4 4000/10080 Up - deploy/tidb-4000 -10.0.1.5:4000 tidb 10.0.1.5 4000/10080 Up - deploy/tidb-4000 -10.0.1.3:9000 tiflash 10.0.1.3 9000/8123/3930/20170/20292/8234 Up data/tiflash-9000 deploy/tiflash-9000 -10.0.1.4:9000 tiflash 10.0.1.4 9000/8123/3930/20170/20292/8234 Up data/tiflash-9000 deploy/tiflash-9000 -10.0.1.5:9290 prometheus 10.0.1.5 9290 Up data/prometheus-9290 deploy/prometheus-9290 -10.0.1.5:3200 grafana 10.0.1.5 3200 Up - deploy/grafana-3200 -10.0.1.5:9293 alertmanager 10.0.1.5 9293/9294 Up data/alertmanager-9293 deploy/alertmanager-9293 -``` + ``` + Starting /root/.tiup/components/cluster/v0.4.6/cluster display + TiDB Cluster: + TiDB Version: v4.0.0-rc + ID Role Host Ports Status Data Dir Deploy Dir + -- ---- ---- ----- ------ -------- ---------- + 10.0.1.4:2379 pd 10.0.1.4 2379/2380 Healthy data/pd-2379 deploy/pd-2379 + 10.0.1.1:20160 tikv 10.0.1.1 20160/20180 Up data/tikv-20160 deploy/tikv-20160 + 10.0.1.2:20160 tikv 10.0.1.2 20160/20180 Up data/tikv-20160 deploy/tikv-20160 + 10.0.1.5:20160 tikv 10.0.1.5 20160/20180 Up data/tikv-20160 deploy/tikv-20160 + 10.0.1.3:4000 tidb 10.0.1.3 4000/10080 Up - deploy/tidb-4000 + 10.0.1.4:4000 tidb 10.0.1.4 4000/10080 Up - deploy/tidb-4000 + 10.0.1.5:4000 tidb 10.0.1.5 4000/10080 Up - deploy/tidb-4000 + 10.0.1.3:9000 tiflash 10.0.1.3 9000/8123/3930/20170/20292/8234 Up data/tiflash-9000 deploy/tiflash-9000 + 10.0.1.4:9000 tiflash 10.0.1.4 9000/8123/3930/20170/20292/8234 Up data/tiflash-9000 deploy/tiflash-9000 + 10.0.1.5:9290 prometheus 10.0.1.5 9290 Up data/prometheus-9290 deploy/prometheus-9290 + 10.0.1.5:3200 grafana 10.0.1.5 3200 Up - deploy/grafana-3200 + 10.0.1.5:9293 alertmanager 10.0.1.5 9293/9294 Up data/alertmanager-9293 deploy/alertmanager-9293 + ``` -### Run the scale-in command +2. Run the scale-in command: -{{< copyable "shell-regular" >}} + {{< copyable "shell-regular" >}} -```shell -tiup cluster scale-in --node 10.0.1.5:20160 -``` + ```shell + tiup cluster scale-in --node 10.0.1.5:20160 + ``` -The `--node` parameter is the ID of the node to be taken offline. + The `--node` parameter is the ID of the node to be taken offline. -If you see the `Scaled cluster in successfully`, the scale-in operation is successfully completed. + If you see the `Scaled cluster in successfully`, the scale-in operation is successfully completed. -### Check the cluster status +3. Check the cluster status: -The scale-in process takes some time. If the status of the node to be scaled in becomes `Tombstone`, that means the scale-in operation is successful. + The scale-in process takes some time. If the status of the node to be scaled in becomes `Tombstone`, that means the scale-in operation is successful. -To check the scale-in status, run the following command: + To check the scale-in status, run the following command: -{{< copyable "shell-regular" >}} + {{< copyable "shell-regular" >}} -```shell -tiup cluster display -``` + ```shell + tiup cluster display + ``` -The current topology is as follows: + The current topology is as follows: -| Host IP | Service | -|:----|:----| -| 10.0.1.3 | TiDB + TiFlash | -| 10.0.1.4 | TiDB + PD + TiFlash | -| 10.0.1.5 | TiDB + Monitor **(TiKV is deleted)** | -| 10.0.1.1 | TiKV | -| 10.0.1.2 | TiKV | + | Host IP | Service | + |:----|:----| + | 10.0.1.3 | TiDB + TiFlash | + | 10.0.1.4 | TiDB + PD + TiFlash | + | 10.0.1.5 | TiDB + Monitor **(TiKV is deleted)** | + | 10.0.1.1 | TiKV | + | 10.0.1.2 | TiKV | -Access the monitoring platform at using your browser to monitor the status of the cluster. + Access the monitoring platform at using your browser to monitor the status of the cluster. ## Scale in a TiFlash node @@ -200,32 +200,32 @@ If you want to remove the TiFlash node from the `10.0.1.4` host, take the follow > > The scale-in process described in this section does not delete the data on the node that goes offline. If you need to bring the node back again, delete the data manually. -### Take the node offline +1. Take the node offline: -To take offline the node to be scaled in, refer to [Take a TiFlash node down](/reference/tiflash/maintain.md#take-a-tiflash-node-down). + To take offline the node to be scaled in, refer to [Take a TiFlash node down](/reference/tiflash/maintain.md#take-a-tiflash-node-down). -### Check the node status +2. Check the node status: -The scale-in process takes some time. + The scale-in process takes some time. -You can use Grafana or pd-ctl to check whether the node has been successfully taken offline. + You can use Grafana or pd-ctl to check whether the node has been successfully taken offline. -### Stop the TiFlash process +3. Stop the TiFlash process: -After the `store` corresponding to TiFlash disappears, or the `state_name` becomes `Tombstone`, execute the following command to stop the TiFlash process: + After the `store` corresponding to TiFlash disappears, or the `state_name` becomes `Tombstone`, execute the following command to stop the TiFlash process: -{{< copyable "shell-regular" >}} + {{< copyable "shell-regular" >}} -```shell -tiup cluster scale-in --node 10.0.1.4:9000 -``` + ```shell + tiup cluster scale-in --node 10.0.1.4:9000 + ``` -### View the cluster status +4. View the cluster status: -{{< copyable "shell-regular" >}} + {{< copyable "shell-regular" >}} -```shell -tiup cluster display -``` + ```shell + tiup cluster display + ``` -Access the monitoring platform at using your browser, and view the status of the cluster. + Access the monitoring platform at using your browser, and view the status of the cluster.