How does Sentinel differ from Redis Cluster?
Redis Sentinel and Redis Cluster solve different problems:
Redis Sentinel, a monitoring and automatic-failover system
Main goal: to provide high availability for a single logical Redis instance.
How it works:
- Sentinel watches the master and its replicas.
- If the master stops responding, the Sentinels hold a vote and promote a replica to master.
- Clients find out about it and automatically switch to the new master.
What it gives you:
- Automatic failover (switching over on failure).
- Monitoring the nodes' state.
- Reassigning master/replica roles.
What it doesn't have:
- Sentinel doesn't split data across nodes (every copy holds identical data).
- There's no scaling by data volume.
It's used when you need:
A single logical Redis, with several copies for reliability.
Redis Cluster, distributed data storage
Main goal: to provide both scaling and high availability by splitting data across nodes.
How it works:
- Keys are distributed across several master nodes via hash slots (16384 in total).
- Every master has one or several replicas.
- If a master fails, its replica automatically becomes the new master.
What it gives you:
- Horizontal scaling (much more data can be stored).
- High availability with no Sentinel needed.
- Automatic recovery and request routing.
What it doesn't have:
- No full isolation, some data can become unavailable if a master and its replicas fail at the same time.
- Some commands (multi-key) work in a limited way.
It's used when you need:
A large volume of data, spread across several servers.
A quick comparison:
| Criterion | Redis Sentinel | Redis Cluster |
|---|---|---|
| Main goal | Fault tolerance | Scaling + fault tolerance |
| Replication | Yes (1 master + N replicas) | Yes (several master-replica sets) |
| Data distribution | No | Yes (by slots) |
| Automatic failover | Yes | Yes |
| Scaling | No | Yes |
| Multi-key support | Full | Limited (within a single slot) |
| Use | A simple HA scheme | A cluster for large data |
Summary:
- Sentinel makes Redis fault-tolerant, but not scalable.
- Cluster makes Redis both fault-tolerant and scalable, by distributing data.
Short Answer
Interview readyPremium
A concise answer to help you respond confidently on this topic during an interview.