Module cartridge.failover
Make decisions regarding instances leadership.
Failover can operate in two modes:
- In
disabled
mode the leader is the first server configured intopology.replicsets[].master
array. - In
eventual
mode the leader isn't elected consistently. Instead, every instance in cluster thinks the leader is the first healthy server in replicaset, while instance health is determined according to membership status (the SWIM protocol).
This module behavior depends on the instance state.
From the very beginig it reports is_rw() == false
,
is_leader() == false
, get_active_leaders() == {}
.
The module is configured when the instance enters ConfiguringRoles
state for the first time. From that moment it reports actual values
according to the mode set in clusterwide config.
(Added in v1.2.0-17)
Local Functions
cfg () | Initialize the failover module. |
get_active_leaders () | Get map of replicaset leaders. |
is_leader () | Check current instance leadership. |
is_rw () | Check current instance writability. |