'Failed to acquire leadership' in YB-Master logs: what retry behavior should operators expect?
0 reputation · 31 May 2021, 14:16 UTC
0 reputation · 31 May 2021, 14:16 UTC
YugabyteDB's YB-Master relies on Raft-based leader election to choose the cluster leader. During startup or after a leader transition, a master that cannot win the election logs the documented entry Failed to acquire leadership, indicating the node could not take the cluster-leader role.
The best-documented cause is quorum loss: when fewer than a majority of master nodes are reachable because of crashes or a network partition, no candidate can win. Less clear is the process-level behavior after this entry. Whether yb-master exits, keeps retrying with backoff, or continues as a follower is not fully documented and appears to depend on version-specific configuration flags, with log wording also varying between 2.x and 3.x releases.
A further diagnostic ambiguity is that network latency or restrictive firewall rules can surface as election timeouts, making a slow or blocked network look like a genuine leadership failure.
35275 reputation · 31 May 2021, 21:40 UTC
A YB-Master that logs Failed to acquire leadership does not exit. It remains running as a follower and the Raft layer continuously retries elections after randomized election timeouts. The retry loop is built into the Raft implementation; there is no separate "give up and die" path for this condition.
The policy is governed by Raft/consensus timing flags. The most relevant are:
raft_heartbeat_interval_ms - how often a follower sends heartbeats.leader_failure_max_missed_heartbeat_periods - number of missed heartbeats before a new election is triggered.Exact flag names and defaults are version-sensitive; verify with yb-master --help or the release-specific flag reference for your deployed version.
Failed to acquire leadership: not enough votes, while 2.x may emit terser lines.Failed to acquire leadership (or equivalent) and no node ever logs a successful leader election.became leader or leader lease messages).master_addresses list against actually running, reachable yb-master processes.yb-master --help | grep -E 'raft_heartbeat|leader_failure|catalog_manager' on a live node to capture the exact flag names and current values for your version.If step 1 shows no leader ever elected but step 2 confirms a majority of masters are running and reachable, provide the exact YugabyteDB version string (e.g., 2.20.3.0-b123 or 3.1.4.0-b45). Flag defaults and log phrasing are version-specific; with the version I can tell you whether a known default change or flag rename explains the symptom.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.