You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/concepts/replication/repl_leader_elect.rst
+17-7Lines changed: 17 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -39,6 +39,16 @@ in the cluster but don't use synchronous spaces at all.
39
39
Synchronous replication has a separate :ref:`documentation section <repl_sync>`.
40
40
Leader election is described below.
41
41
42
+
.. note::
43
+
44
+
The system behavior can be specified exactly according to the Raft algorithm. To do this:
45
+
46
+
* Ensure that the user has only synchronous spaces.
47
+
* Set the :ref:`replication_synchro_quorum <repl_leader_elect_config>` option to ``N / 2 + 1``.
48
+
* Set the :ref:`replication_synchro_timeout <cfg_replication-replication_synchro_timeout>` option to infinity.
49
+
* In the :ref:`election_fencing_mode <repl_leader_elect_config>` option, select either the ``soft`` mode (the default)
50
+
or the ``strict`` mode, which is more restrictive.
51
+
42
52
.. _repl_leader_elect_process:
43
53
44
54
Leader election process
@@ -56,7 +66,7 @@ After the first boot, each node has its term equal to 1. When a node sees that
56
66
it is not a leader and there is no leader available for some time in the replica
57
67
set, it increases the term and starts a new leader election round.
58
68
59
-
Leader election happens via votes. The node, which started the election, votes
69
+
Leader election happens via votes. The node that started the election votes
60
70
for itself and sends vote requests to other nodes.
61
71
Upon receiving vote requests, a node votes for the first of them, and then cannot
62
72
do anything in the same term but wait for a leader to be elected.
@@ -67,7 +77,7 @@ and notifies other nodes about that. Also, a split vote can happen
67
77
when no nodes received a quorum of votes. In this case,
68
78
after a :ref:`random timeout <repl_leader_elect_config>`,
69
79
each node increases its term and starts a new election round if no new vote
70
-
request with a greater term arrives during this time period.
80
+
request with a greater term arrives during this time.
71
81
Eventually, a leader is elected.
72
82
73
83
If any unfinalized synchronous transactions are left from the previous leader,
@@ -85,7 +95,8 @@ a non-leader node starts a new election if the following conditions are met:
85
95
86
96
.. note::
87
97
88
-
A cluster member considers the leader node to be alive if the member received heartbeats from the leader at least once during the period of ``replication_timeout * 4``,
98
+
A cluster member considers the leader node to be alive if the member received heartbeats from the leader at least
99
+
once during the ``replication_timeout * 4``,
89
100
and there are no replication errors (the connection is not broken due to timeout or due to an error).
90
101
91
102
Terms and votes are persisted by each instance to preserve certain Raft guarantees.
@@ -136,12 +147,11 @@ Once noticing the error, a user can choose any representative from each of the s
136
147
To correlate the data, the user should remove it from the nodes of one set,
137
148
and reconnect them to the nodes from the other set that have the correct data.
138
149
139
-
Also, if election is enabled on the node, it won't replicate from any nodes except
150
+
Also, if election is enabled on the node, it doesn't replicate from any nodes except
140
151
the newest leader. This is done to avoid the issue when a new leader is elected,
141
152
but the old leader has somehow survived and tries to send more changes
142
153
to the other nodes.
143
154
144
155
Term numbers also work as a kind of filter.
145
-
For example, you can be sure that if election
146
-
is enabled on two nodes and ``node1`` has the term number less than ``node2``,
147
-
then ``node2`` won't accept any transactions from ``node1``.
156
+
For example, if election is enabled on two nodes and ``node1`` has the term number less than ``node2``,
157
+
then ``node2`` doesn't accept any transactions from ``node1``.
0 commit comments