High availability with Sentinel
- One primary, its replicas and the control-plane votes that authorize promotion.
Select a component to trace its direct connections. Drag to pan · Ctrl + wheel or pinch to zoom.
- Sentinel tells the client which server currently accepts writes. The client sends commands straight to that primary. Each replica follows the entire dataset.
- If Zone 1 fails, Sentinels B and C can agree the primary is down and elect one Sentinel to promote a replica. One surviving Sentinel cannot authorize promotion here.
- Clients ask Sentinel for the new address and reconnect. A write acknowledged just before the failure can be missing if it had yet to reach the promoted replica.
Reading
- All three Sentinels monitor the replication group and communicate with one another. The drawing shows representative control links.
- One primary owns all keys. Moving write capacity to another host requires a new primary and client rediscovery.
High availability with Sentinel
High availability with Sentinel
Redis Open Source 7.2 architecture
Place the voting processes
- Put a data node and a Sentinel in each of three independent zones. Provision replication first, then configure the same named primary on each Sentinel.
- A Sentinel-aware client takes several Sentinel addresses as seeds. It asks for the primary by service name and connects to that Redis endpoint.
- Keep the Sentinel configuration file writable. Sentinel persists peer discovery and topology changes there. Supply network reachability, authentication and TLS appropriate to the environment.
Three Sentinels monitoring one primaryconf
# Teaching fragment for each of three Sentinel processes, one per zone.
# 192.0.2.10 represents the initially provisioned primary. Supply a reachable
# private address, matching access controls and a writable Sentinel config.
sentinel monitor catalog 192.0.2.10 6379 2
sentinel down-after-milliseconds catalog 5000
sentinel failover-timeout catalog 60000
sentinel parallel-syncs catalog 1
# Clients use Sentinel seeds and the service name "catalog" to discover a
# primary. The data nodes and their initial replication are provisioned separately.
Lose one zone
| Event | Decision or effect |
|---|---|
| A stops responding to one observer | That Sentinel can mark A subjectively down after its configured interval. |
| Two of three agree A is down | Quorum 2 permits the objective-down decision. Two votes can also authorize a failover in this three-Sentinel topology. |
| B or C is eligible | The elected Sentinel promotes one replica and reconfigures replication. Clients reconnect and rediscover the primary. |
| Only one Sentinel remains reachable | It lacks a majority to authorize failover. Existing service availability depends on the reachable data node. |
- With five Sentinels and quorum 2, two can recognize failure while three votes are required to authorize failover. A configured quorum above the majority also raises the authorization threshold.
- Detection time, election, promotion, client reconnect and retry all contribute to the outage. The configured five seconds covers only one part.
Choose the write contract
- Replication lag creates a loss window. After a partition, the old primary may accept writes that disappear when it rejoins as a replica.
- A minimum healthy-replica policy can stop writes under sustained lag. This trades availability for a smaller loss window.
- WAIT on the same client connection can request replica acknowledgments for preceding writes. Inspect the returned count on timeout. Reconcile ambiguous business outcomes before repeating an operation.
- Add replicas for eligible reads or recovery. Write throughput and the dataset size still depend on the single primary.