Skip to content

Commit

Permalink
how-to/scale: add necessary actions on the target machines for dev (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
TomShawn committed Mar 4, 2020
1 parent 2ea89e2 commit 6c0b05a
Showing 1 changed file with 85 additions and 44 deletions.
129 changes: 85 additions & 44 deletions how-to/scale/with-ansible.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,45 +29,47 @@ TiDB 集群可以在不影响线上服务的情况下进行扩容和缩容。

例如,如果要添加两个 TiDB 节点(node101、node102),IP 地址为 172.16.10.101、172.16.10.102,可以进行如下操作:

1. 编辑 `inventory.ini` 文件,添加节点信息:

```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
```
1. 编辑 `inventory.ini` 文件和 `hosts.ini` 文件,添加节点信息。

- 编辑 `inventory.ini`

```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
```

现在拓扑结构如下所示:

Expand All @@ -85,13 +87,52 @@ TiDB 集群可以在不影响线上服务的情况下进行扩容和缩容。
| node8 | 172.16.10.8 | TiKV3 |
| node9 | 172.16.10.9 | TiKV4 |

2. 初始化新增节点:
- 编辑 `hosts.ini`:

```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
```

{{< copyable "shell-regular" >}}
2. 初始化新增节点。

```bash
ansible-playbook bootstrap.yml -l 172.16.10.101,172.16.10.102
```
1. 在中控机上配置部署机器 SSH 互信及 sudo 规则:

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

```bash
ansible-playbook -i hosts.ini create_users.yml -l 172.16.10.101,172.16.10.102 -u root -k
```

2. 在部署目标机器上安装 NTP 服务:

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

```bash
ansible-playbook -i hosts.ini deploy_ntp.yml -u tidb -b
```

3. 在部署目标机器上初始化节点:

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

```bash
ansible-playbook bootstrap.yml -l 172.16.10.101,172.16.10.102
```

> **注意:**
>
Expand Down

0 comments on commit 6c0b05a

Please sign in to comment.