Skip to content

Commit b67c23f

Browse files
authored
adjust the recommend value of raft election-timeout in multi dc deplo… (#16561) (#16576)
1 parent 85546d7 commit b67c23f

File tree

4 files changed

+19
-11
lines changed

4 files changed

+19
-11
lines changed

config-templates/geo-redundancy-deployment.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ tikv_servers:
107107
host: host1
108108
readpool.storage.use-unified-pool: true
109109
readpool.storage.low-concurrency: 10
110-
raftstore.raft-min-election-timeout-ticks: 1000
111-
raftstore.raft-max-election-timeout-ticks: 1020
110+
raftstore.raft-min-election-timeout-ticks: 50
111+
raftstore.raft-max-election-timeout-ticks: 60
112112
monitoring_servers:
113113
- host: 10.0.1.16
114114
grafana_servers:

dr-multi-replica.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ In this example, TiDB contains five replicas and three regions. Region 1 is the
7474
config:
7575
server.labels: { Region: "Region3", AZ: "AZ5" }
7676

77-
raftstore.raft-min-election-timeout-ticks: 1000
78-
raftstore.raft-max-election-timeout-ticks: 1200
77+
raftstore.raft-min-election-timeout-ticks: 50
78+
raftstore.raft-max-election-timeout-ticks: 60
7979

8080
monitoring_servers:
8181
- host: tidb-dr-test2

geo-distributed-deployment-topology.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,14 @@ This section describes the key parameter configuration of the TiDB geo-distribut
5656
- To prevent remote TiKV nodes from launching unnecessary Raft elections, it is required to increase the minimum and maximum number of ticks that the remote TiKV nodes need to launch an election. The two parameters are set to `0` by default.
5757

5858
```yaml
59-
raftstore.raft-min-election-timeout-ticks: 1000
60-
raftstore.raft-max-election-timeout-ticks: 1020
59+
raftstore.raft-min-election-timeout-ticks: 50
60+
raftstore.raft-max-election-timeout-ticks: 60
6161
```
6262

63+
> **Note:**
64+
>
65+
> Using `raftstore.raft-min-election-timeout-ticks` and `raftstore.raft-max-election-timeout-ticks` to configure larger election timeout ticks for a TiKV node can significantly decrease the likelihood of Regions on that node becoming Leaders. However, in a disaster scenario where some TiKV nodes are offline and the remaining active TiKV nodes lag behind in Raft logs, only Regions on this TiKV node with large election timeout ticks can become Leaders. Because Regions on this TiKV node must wait for at least the duration set by `raftstore.raft-min-election-timeout-ticks' before initiating an election, it is recommended to avoid setting these values excessively large to prevent potential impact on the cluster availability in such scenarios.
66+
6367
#### PD parameters
6468

6569
- The PD metadata information records the topology of the TiKV cluster. PD schedules the Raft Group replicas on the following four dimensions:

three-data-centers-in-two-cities-deployment.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ tikv_servers:
113113
- host: 10.63.10.34
114114
config:
115115
server.labels: { az: "3", replication zone: "5", rack: "5", host: "34" }
116-
raftstore.raft-min-election-timeout-ticks: 1000
117-
raftstore.raft-max-election-timeout-ticks: 1200
116+
raftstore.raft-min-election-timeout-ticks: 50
117+
raftstore.raft-max-election-timeout-ticks: 60
118118

119119
monitoring_servers:
120120
- host: 10.63.10.60
@@ -174,11 +174,15 @@ In the deployment of three AZs in two regions, to optimize performance, you need
174174
- Optimize the network configuration of the TiKV node in another region (San Francisco). Modify the following TiKV parameters for AZ3 in San Francisco and try to prevent the replica in this TiKV node from participating in the Raft election.
175175

176176
```yaml
177-
raftstore.raft-min-election-timeout-ticks: 1000
178-
raftstore.raft-max-election-timeout-ticks: 1200
177+
raftstore.raft-min-election-timeout-ticks: 50
178+
raftstore.raft-max-election-timeout-ticks: 60
179179
```
180180

181-
- Configure scheduling. After the cluster is enabled, use the `tiup ctl:v<CLUSTER_VERSION> pd` tool to modify the scheduling policy. Modify the number of TiKV Raft replicas. Configure this number as planned. In this example, the number of replicas is five.
181+
> **Note:**
182+
>
183+
> Using `raftstore.raft-min-election-timeout-ticks` and `raftstore.raft-max-election-timeout-ticks` to configure larger election timeout ticks for a TiKV node can significantly decrease the likelihood of Regions on that node becoming Leaders. However, in a disaster scenario where some TiKV nodes are offline and the remaining active TiKV nodes lag behind in Raft logs, only Regions on this TiKV node with large election timeout ticks can become Leaders. Because Regions on this TiKV node must wait for at least the duration set by `raftstore.raft-min-election-timeout-ticks' before initiating an election, it is recommended to avoid setting these values excessively large to prevent potential impact on the cluster availability in such scenarios.
184+
185+
- Configure scheduling. After the cluster is enabled, use the `tiup ctl:v{CLUSTER_VERSION} pd` tool to modify the scheduling policy. Modify the number of TiKV Raft replicas. Configure this number as planned. In this example, the number of replicas is five.
182186

183187
```bash
184188
config set max-replicas 5

0 commit comments

Comments
 (0)