Redis HA modes compared
The ways to run Redis with more than one copy, side by side, including one Sentinel group shared by many services. What each does when the primary dies, how big your data can get, and what your app has to support.
Pick two or three to compare.
ReplicationSee it work
One primary (master) takes every write and copies it to its replicas (slaves). Nothing takes over if it dies.
SentinelSee it work
Replication plus Sentinels that watch the primary, agree when it's down, and promote a replica.
Side by side
- Fails over by itself
- ReplicationNo. You run REPLICAOF NO ONE on a replica and repoint everything.
- SentinelYes. A quorum of Sentinels agrees, a majority elects a leader, and it promotes a replica.
- How fast
- ReplicationWhen someone notices
- Sentineldown-after-milliseconds, then a few seconds (the Bitnami chart defaults to 60 s)
- Data size
- ReplicationFits in one server's memory
- SentinelFits in one server's memory
- Writes go to
- ReplicationOne primary
- SentinelOne primary
- Smallest setup on Kubernetes
- Replication2 pods, with no failover
- Sentinel3 pods, each running Redis and Sentinel
- Your app needs
- ReplicationAny Redis client, pointed at the primary for writes
- SentinelA Sentinel-aware client that asks for the master set (mymaster)
- Multi-key commands
- ReplicationAll work
- SentinelAll work
- Numbered databases (SELECT)
- Replication16 by default
- Sentinel16 by default
- Can lose an acknowledged write
- ReplicationYes, replication is asynchronous
- SentinelYes, during a failover. min-replicas-to-write narrows the window.
- With Helm
- ReplicationBitnami redis, architecture: replication
- SentinelBitnami redis, sentinel.enabled: true
- Common mistake
- ReplicationPersistence off with automatic restarts. The primary comes back empty and the replicas copy the empty dataset.
- SentinelPointing the app at one pod's address instead of asking Sentinel, so it keeps writing to the old primary.
Which to choose
Choose Replication if
- You want copies of the data and replicas to spread reads, and a short outage while the primary restarts is fine.
- You're learning how Redis copies data before adding failover.
Choose Sentinel if
- Your data fits in one server's memory and you want automatic failover.
- Your app uses multi-key commands, transactions or Lua scripts across any keys.
Our view: If your data fits in one server's memory, use Sentinel. It fails over by itself and every command keeps working. With many services that each have their own Redis, share one group of three Sentinels between them. Move to Cluster only when the data or the write load outgrows one server. Plain replication is for read copies and for learning, not for staying up.
#See them fail over
Each mode is animated failing over, with the storage underneath it, in How Redis stays up on Kubernetes.
To set one up with Helm or plain YAML, follow Set up Redis high availability on Kubernetes.