From 8d0b41b10715ebe1dbb6e78d6162bd3660a1e4d1 Mon Sep 17 00:00:00 2001 From: toutdesuite Date: Wed, 18 Mar 2020 21:02:53 +0800 Subject: [PATCH 1/2] cherry pick #2024 to release-3.0 Signed-off-by: sre-bot --- how-to/scale/with-ansible.md | 144 +++++++++++++++++++++++------------ 1 file changed, 96 insertions(+), 48 deletions(-) diff --git a/how-to/scale/with-ansible.md b/how-to/scale/with-ansible.md index d93de78a5d292..f54e520db0f89 100644 --- a/how-to/scale/with-ansible.md +++ b/how-to/scale/with-ansible.md @@ -31,69 +31,117 @@ Assume that the topology is as follows: For example, if you want to add two TiDB nodes (node101, node102) with the IP addresses `172.16.10.101` and `172.16.10.102`, take the following steps: -1. Edit the `inventory.ini` file and append the node information: +1. Edit the `inventory.ini` file and the `hosts.ini` file, and append the node information. + + - Edit the `inventory.ini` file: + + ```ini + [tidb_servers] + 172.16.10.4 + 172.16.10.5 + 172.16.10.101 + 172.16.10.102 + + [pd_servers] + 172.16.10.1 + 172.16.10.2 + 172.16.10.3 + + [tikv_servers] + 172.16.10.6 + 172.16.10.7 + 172.16.10.8 + 172.16.10.9 + + [monitored_servers] + 172.16.10.1 + 172.16.10.2 + 172.16.10.3 + 172.16.10.4 + 172.16.10.5 + 172.16.10.6 + 172.16.10.7 + 172.16.10.8 + 172.16.10.9 + 172.16.10.101 + 172.16.10.102 + + [monitoring_servers] + 172.16.10.3 + + [grafana_servers] + 172.16.10.3 + ``` - ```ini - [tidb_servers] - 172.16.10.4 - 172.16.10.5 - 172.16.10.101 - 172.16.10.102 + Now the topology is as follows: + + | Name | Host IP | Services | + | ---- | ------- | -------- | + | node1 | 172.16.10.1 | PD1 | + | node2 | 172.16.10.2 | PD2 | + | node3 | 172.16.10.3 | PD3, Monitor | + | node4 | 172.16.10.4 | TiDB1 | + | node5 | 172.16.10.5 | TiDB2 | + | **node101** | **172.16.10.101**|**TiDB3** | + | **node102** | **172.16.10.102**|**TiDB4** | + | node6 | 172.16.10.6 | TiKV1 | + | node7 | 172.16.10.7 | TiKV2 | + | node8 | 172.16.10.8 | TiKV3 | + | node9 | 172.16.10.9 | TiKV4 | + + - Edit the `hosts.ini` file: + + ```ini + [servers] + 172.16.10.1 + 172.16.10.2 + 172.16.10.3 + 172.16.10.4 + 172.16.10.5 + 172.16.10.6 + 172.16.10.7 + 172.16.10.8 + 172.16.10.9 + 172.16.10.101 + 172.16.10.102 + [all:vars] + username = tidb + ntp_server = pool.ntp.org + ``` - [pd_servers] - 172.16.10.1 - 172.16.10.2 - 172.16.10.3 +2. Initialize the newly added node. - [tikv_servers] - 172.16.10.6 - 172.16.10.7 - 172.16.10.8 - 172.16.10.9 + 1. Configure the SSH mutual trust and sudo rules of the deployment machine on the central control machine: - [monitored_servers] - 172.16.10.1 - 172.16.10.2 - 172.16.10.3 - 172.16.10.4 - 172.16.10.5 - 172.16.10.6 - 172.16.10.7 - 172.16.10.8 - 172.16.10.9 - 172.16.10.101 - 172.16.10.102 + {{< copyable "shell-regular" >}} - [monitoring_servers] - 172.16.10.3 + ```bash + ansible-playbook -i hosts.ini create_users.yml -l 172.16.10.101,172.16.10.102 -u root -k + ``` - [grafana_servers] - 172.16.10.3 - ``` + 2. Install the NTP service on the deployment target machine: - Now the topology is as follows: + {{< copyable "shell-regular" >}} - | Name | Host IP | Services | - | ---- | ------- | -------- | - | node1 | 172.16.10.1 | PD1 | - | node2 | 172.16.10.2 | PD2 | - | node3 | 172.16.10.3 | PD3, Monitor | - | node4 | 172.16.10.4 | TiDB1 | - | node5 | 172.16.10.5 | TiDB2 | - | **node101** | **172.16.10.101**|**TiDB3** | - | **node102** | **172.16.10.102**|**TiDB4** | - | node6 | 172.16.10.6 | TiKV1 | - | node7 | 172.16.10.7 | TiKV2 | - | node8 | 172.16.10.8 | TiKV3 | - | node9 | 172.16.10.9 | TiKV4 | + ```bash + ansible-playbook -i hosts.ini deploy_ntp.yml -u tidb -b + ``` -2. Initialize the newly added node: + 3. Initialize the node on the deployment target machine: +<<<<<<< HEAD {{< copyable "shell-regular" >}} ```bash ansible-playbook bootstrap.yml -l 172.16.10.101,172.16.10.102 ``` +======= + {{< copyable "shell-regular" >}} + + ```bash + ansible-playbook bootstrap.yml -l 172.16.10.101,172.16.10.102 + ``` +>>>>>>> b878e6c... how-to/scale: add necessary actions on the target machines (#2024) > **Note:** > From 8dad8277375c3146772191df967bb3df08fa1dd5 Mon Sep 17 00:00:00 2001 From: toutdesuite Date: Wed, 18 Mar 2020 21:22:45 +0800 Subject: [PATCH 2/2] resolve conflict --- how-to/scale/with-ansible.md | 8 -------- 1 file changed, 8 deletions(-) diff --git a/how-to/scale/with-ansible.md b/how-to/scale/with-ansible.md index f54e520db0f89..c27ea58735c2b 100644 --- a/how-to/scale/with-ansible.md +++ b/how-to/scale/with-ansible.md @@ -129,19 +129,11 @@ For example, if you want to add two TiDB nodes (node101, node102) with the IP ad 3. Initialize the node on the deployment target machine: -<<<<<<< HEAD - {{< copyable "shell-regular" >}} - - ```bash - ansible-playbook bootstrap.yml -l 172.16.10.101,172.16.10.102 - ``` -======= {{< copyable "shell-regular" >}} ```bash ansible-playbook bootstrap.yml -l 172.16.10.101,172.16.10.102 ``` ->>>>>>> b878e6c... how-to/scale: add necessary actions on the target machines (#2024) > **Note:** >