Redis Sentinel: automatic failover and high availability explained
Sentinel process, quorum, leader election, failover process, client reconfiguration, sentinel.conf, minimum 3 sentinels rule
Redis Sentinel for high availability
Sentinel is a separate process that monitors your Redis instances and automatically promotes a replica to primary when the primary fails.
Minimal Sentinel config
# sentinel.conf
sentinel monitor mymaster 127.0.0.1 6379 2
sentinel down-after-milliseconds mymaster 5000
sentinel failover-timeout mymaster 60000# Start Sentinel
redis-sentinel /etc/redis/sentinel.confHow failover works
Sentinels continuously ping the primary. If a primary fails to respond within down-after-milliseconds, a Sentinel marks it as subjectively down (SDOWN). When enough Sentinels agree — reaching the quorum — it becomes objectively down (ODOWN). Sentinels elect a leader among themselves who initiates failover: promotes the best replica, reconfigures other replicas to follow the new primary, and notifies clients via the Pub/Sub API.
Why 3 Sentinels
With quorum = 2, you need at least 3 Sentinels to form a majority and elect a leader. Two Sentinels can detect failure but cannot achieve a majority vote, so failover never triggers. Always deploy an odd number of Sentinels (3 or 5) across different hosts.
