Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pd: add note for member leader_priority #18866

Merged
merged 11 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dr-multi-replica.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ summary: 了解 TiDB 提供的基于多副本的单集群容灾方案。
tiup bench tpcc prepare -H 127.0.0.1 -P 4000 -D tpcc --warehouses 1
```

指定 PD leader 的优先级:
指定 PD leader 的优先级

```shell
tiup ctl:v6.4.0 pd member leader_priority pd-1 4
Expand All @@ -119,7 +119,7 @@ summary: 了解 TiDB 提供的基于多副本的单集群容灾方案。

> **注意:**
>
> 优先级数值越大的节点成为 leader 的可能性越高
> 在可用的 PD 节点中,优先级数值最大的节点会直接当选 leader

3. 创建 placement rule,并将测试表的主副本固定在区域 1:

Expand Down
14 changes: 14 additions & 0 deletions pd-control.md
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,20 @@ member leader transfer pd3
......
```

指定 PD leader 的优先级:

```bash
member leader_priority pd-1 4
member leader_priority pd-2 3
member leader_priority pd-3 2
member leader_priority pd-4 1
member leader_priority pd-5 0
```

> **注意:**
>
> 在可用的 PD 节点中,优先级数值最大的节点会直接当选 leader。

### `operator [check | show | add | remove]`

用于显示和控制调度操作。
Expand Down
2 changes: 1 addition & 1 deletion placement-rules-in-sql.md
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ SHOW PLACEMENT;
如果你对 Raft Leader 的分布节点有要求,可以使用如下语句指定:

```sql
CREATE PLACEMENT POLICY deploy221_primary_east1 LEADER_CONSTRAINTS="[+region=us-east-1]" FOLLOWER_CONSTRAINTS='{"+region=us-east-1": 1, "+region=us-east-2": 2, "+region=us-west-1: 1}';
CREATE PLACEMENT POLICY deploy221_primary_east1 LEADER_CONSTRAINTS="[+region=us-east-1]" FOLLOWER_CONSTRAINTS='{"+region=us-east-1": 1, "+region=us-east-2": 2, "+region=us-west-1": 1}';
```

该放置策略创建好并绑定到所需的数据后,这些数据的 Raft Leader 副本将会放置在 `LEADER_CONSTRAINTS` 选项指定的 `us-east-1` 区域中,其他副本将会放置在`FOLLOWER_CONSTRAINTS` 选项指定的区域。需要注意的是,如果集群发生故障,比如 Leader 所在区域 `us-east-1` 的节点宕机,这时候即使其他区域设置的都是 `FOLLOWER_CONSTRAINTS`, 也会从中选举出一个新的 Leader,也就是说保证服务可用的优先级是最高的。
Expand Down
2 changes: 1 addition & 1 deletion three-data-centers-in-two-cities-deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ tikv_servers:
>
> TiDB 5.2 及以上版本默认不支持 `label-property` 配置。若要设置副本策略,请使用 [Placement Rules](/configure-placement-rules.md)。

- 设置 PD 的优先级,为了避免出现跨区域 AZ 的 PD 成为 Leader,可以将本区域 AZ 的 PD 优先级调高(数字越大,优先级越高),将跨区域的 PD 优先级调低。
- 设置 PD 的优先级,为了避免出现跨区域 AZ 的 PD 成为 Leader,可以将本区域 AZ 的 PD 优先级调高(数字越大,优先级越高),将跨区域的 PD 优先级调低。在可用的 PD 节点中,优先级数值最大的节点会直接当选 leader。

```
member leader_priority PD-10 5
Expand Down