Database / ValKey Interview questions
How does Valkey handle automatic failover in Sentinel mode?
Sentinels continuously ping the primary and its replicas. When a Sentinel stops getting timely responses from the primary, it privately marks it subjectively down (SDOWN); once enough Sentinels report the same thing, it becomes objectively down (ODOWN) based on the configured quorum.
The Sentinels then run a leader election among themselves, and the elected leader Sentinel selects the best-positioned replica, typically the one with the most up-to-date replication offset and highest configured priority, and promotes it with REPLICAOF NO ONE.
The remaining replicas are reconfigured to follow the new primary, and Sentinel-aware clients are told the new primary's address so application traffic resumes automatically.
More Related questions...