CephVIII · MonitorsMonitors
Monitor election and the leader lease
What you'll learn
- Describe the election process and how a leader is chosen
- Explain the lease mechanism and its timing parameters
- Interpret election frequency as a signal
- Respond correctly to a cluster stuck in election
Prerequisites
None — start here.
Verified against Ceph Tentacle 20.2.x · Ceph Squid 19.2.x (supported previous) · cephadm matches the verified Ceph release · podman 4.x · csi-rbd and csi-cephfs current · RBD / CephFS / RGW current (matches Ceph release) · Linux kernel 5.15+ (5.10 minimum) · Ubuntu 24.04 LTS (Ceph host baseline) · Debian 12 (Bookworm) (Ceph host baseline) · Rocky Linux / RHEL / AlmaLinux 9.x (Ceph host baseline) · Proxmox VE 9.x (cross-course integration) · Kubernetes 1.31+ (cross-course integration) · 2026-08-18
Why this matters in production
Elections are how monitors recover from disruption, and their
frequency is a precise signal about cluster health that no dashboard
summarises. A cluster electing constantly is a cluster in trouble even
when ceph status says HEALTH_OK between elections.
How a leader is chosen
Each monitor has a rank, assigned by position in the monmap and ordered by address. Elections favour the lowest rank among those participating:
1. A monitor detects a problem (lease expiry, peer change, startup)
2. It proposes an election, incrementing the election epoch
3. Monitors respond; each defers to any lower-ranked participant
4. The lowest-ranked participant wins and becomes leader
5. The leader establishes quorum and grants leases
Because rank derives from address ordering, the leader is usually the same monitor. That is expected — leadership does not rotate for fairness.
ceph quorum_status --format json-pretty | jq '.quorum_leader_name, .quorum_names'
ceph mon stat
The lease
mon_lease 5.0s lease duration
mon_lease_renew_interval_factor 0.6 renew at 60% of lease
mon_lease_ack_timeout_factor 2.0 leader waits this multiple for acks
mon_election_timeout 5.0s how long an election may take
The leader renews leases every three seconds by default. A peon that does not hear from the leader within five seconds declares the lease expired, stops serving reads, and calls an election.
These defaults assume a datacentre network. On a stretched cluster with meaningful inter-site latency they are worth reviewing — but only with measurements, since raising them delays recovery from genuine leader failure.
Election frequency as a signal
cephadm logs --name mon.ceph-01 --since 24h | grep -c 'calling new monitor election'
| Count over 24h | Reading |
|---|---|
| 0-2 | normal; restarts or brief blips |
| 3-10 | investigate: network jitter or a slow monitor |
| 10+ | a real fault; the cluster is spending its time electing |
This count belongs in monitoring. It is cheap to collect and it detects a class of problem — intermittent network degradation between monitors — that nothing else surfaces until it becomes an outage.
Reading the outcome
After any election, confirm the result rather than assuming it:
ceph quorum_status --format json-pretty
Check that the expected monitors are present, that the leader is sensible, and that the election epoch has stopped incrementing.
Quiz
Knowledge check · 4 questions
Q1. A cluster is stuck calling elections and ceph status hangs. What should be done first?
Q2. MON_CLOCK_SKEW is a cosmetic warning that can be safely ignored if the cluster is otherwise healthy.
Q3. A monitoring check counts 47 election events across the monitor logs in the last 24 hours. Health is currently OK. Investigate.
Three monitors on dedicated hosts. Health is OK at the moment of checking and has been OK for most of the day, with brief warnings. 47 "calling new monitor election" entries in 24 hours across the three logs. Client latency shows unexplained spikes. Monitor CPU is low and RocksDB commit latency is normal on all three.
Q4. Explain how a monitor leader is chosen and why leadership does not rotate.
Passing score: 75%. Answers are checked in this browser.
Production discipline
Add the election count to monitoring — a few per day is normal, dozens
means an active fault, and nothing else in Ceph surfaces this class of
problem before it becomes an outage. When a cluster is stuck electing,
read logs and test the network and clocks rather than restarting
monitors, since each restart adds an election and removes evidence.
Treat MON_CLOCK_SKEW as a cause rather than a cosmetic warning, and
verify time synchronisation on monitor hosts rather than assuming the
platform provides it.
Cross-course references
- Ceph: Part LII (Time Synchronisation) for getting clocks right.
- Ceph: Part IX (Monitor Quorum) for the availability model.
- Ceph: Part CXVII (Lost Monitor Quorum) for the worst case.