Redis Cluster vs Redis Sentinel: High Availability and Horizontal Scaling
Fast recall
Quick revision
Core answer
Understanding of the architectural difference between HA-only vs HA-plus-sharding, and awareness of Cluster's limitations like multi-key operation restrictions.
Thinking Sentinel provides sharding or that Cluster replaces Sentinel — Cluster has its own built-in failover, so you do not need Sentinel with Cluster.
Mention that Redis Cluster uses consistent hashing with 16,384 hash slots, discuss the limitations of multi-key operations (keys must be in the same slot unless using hash tags), and mention that Spring Data Redis supports both via LettuceConnectionFactory.
Interview-ready guide
Interview answer
Redis Sentinel and Redis Cluster solve different problems. Sentinel provides high availability for a single dataset; Cluster provides both high availability and horizontal data partitioning across multiple nodes.
Redis Sentinel — HA for a single dataset
- Sentinel monitors a primary-replica set and performs automatic failover — if the primary becomes unreachable, Sentinel promotes the replica with the most current data and updates clients about the new primary address
- Sentinel itself runs on separate processes (typically three) to avoid a single point of failure in the monitoring layer; a majority of Sentinels must agree before promoting a replica
- All data lives on one primary (plus replicas) — Sentinel doesn't partition data, it just ensures the primary is always available; dataset size is limited by one node's RAM
Redis Cluster — data partitioned across N primaries
- Cluster splits the keyspace into 16,384 hash slots and distributes them across multiple primary nodes — which means the total dataset size can exceed one node's RAM because different keys live on different nodes
- Each primary has its own replica(s) for failover within its slot range — losing a primary promotes its replica automatically without external Sentinel processes
- Cluster introduces key restrictions: multi-key commands (
MGET,SUNIONSTORE) only work when all keys map to the same hash slot; use{hashtag}in key names to force co-location of related keys
Which to choose
- Use Sentinel when your dataset fits on one Redis instance but you need failover — the operational simplicity is significant and most Spring Boot applications don't need to partition their Redis data
- Use Cluster when your dataset is too large for one node's RAM, or write throughput exceeds what one primary can handle
- In Spring Boot: configure
spring.redis.sentinel.masterandspring.redis.sentinel.nodesfor Sentinel;spring.redis.cluster.nodesfor Cluster
Redis Cluster vs Redis Sentinel: High Availability and Horizontal Scaling
Direct Answer
Redis Sentinel provides high availability for a single Redis dataset through automatic failover: it monitors a primary and replicas, promoting a replica if the primary fails. Redis Cluster provides both high availability and horizontal scaling by sharding the keyspace across multiple primary nodes (each with its own replicas), supporting datasets larger than a single node's memory and distributing read/write load. Use Sentinel when one node has enough capacity; use Cluster when you need to scale beyond a single node.
Code Example
Spring Boot configuration for Sentinel and Cluster:
Sentinel configuration (application.yml):
spring:
data:
redis:
sentinel:
master: mymaster
nodes:
- sentinel-1:26379
- sentinel-2:26379
- sentinel-3:26379
password: ${REDIS_PASSWORD}
lettuce:
pool:
max-active: 16
Cluster configuration (application.yml):
spring:
data:
redis:
cluster:
nodes:
- redis-1:6379
- redis-2:6379
- redis-3:6379
- redis-4:6379
- redis-5:6379
- redis-6:6379
max-redirects: 3 # Max MOVED/ASK redirections per command
password: ${REDIS_PASSWORD}
lettuce:
pool:
max-active: 16
Both modes use the same LettuceConnectionFactory — your RedisTemplate and @Cacheable code does not change. The Lettuce driver handles Sentinel master discovery and Cluster slot routing transparently.
// Hash tags force related keys to the same Cluster slot
String profileKey = "{user:42}:profile";
String settingsKey = "{user:42}:settings";
// Both keys hash on "user:42" → guaranteed same slot → MGET works
redisTemplate.opsForValue().multiGet(List.of(profileKey, settingsKey));
Common Mistakes & Pitfalls
Thinking Sentinel provides sharding or that Cluster replaces Sentinel — Cluster has its own built-in failover, so you do not need Sentinel with Cluster.
Check your understanding
Answer these without looking back at the article.
- How does Redis Cluster handle the case when a primary fails and has no available replicas?
- What are hash tags in Redis Cluster and when do you need them?
- Can you use Redis Cluster with Spring's @Cacheable annotation without any code changes?
Related interview prep categories
1Looking for a structured roadmap?
Every module on this page is also part of the full Java backend interview track.