Interview › Databases & Caching
What is Redis Cluster, and how does sharding with hash slots work?
Databases & Caching · Advanced level
Answer
Redis Cluster shards the keyspace across 16,384 hash slots owned by primary nodes, with replicas for HA. Clients must be cluster-aware and multi-key operations need keys in the same slot.
Technical explanation
Redis Cluster splits keys across 16,384 hash slots.
Each primary owns slots and replicas provide HA for those slots.
Clients must handle MOVED/ASK redirects, and multi-key operations need same-slot keys.
Hands-on example
Hash-tag example:
cart:{user123}:items
cart:{user123}:total
CLUSTER KEYSLOT cart:{user123}:items
CLUSTER KEYSLOT cart:{user123}:total
Both should map to the same slot.
Preparing for an interview?
Check how well your resume matches the role with our free resume checker— match score, ATS check, and the skills you're missing.
More Databases & Caching interview questions
- What is Amazon RDS, and what does it manage for you versus self-managed databases?
- What database engines does RDS support?
- What is the difference between RDS and Aurora?
- What is Multi-AZ in RDS, and how does automatic failover work?
- How long does an RDS Multi-AZ failover typically take, and what triggers it?
- What is the difference between Multi-AZ and a read replica?
- When would you use a read replica, and can it become a standalone database?
- Can a read replica be in a different region, and why would you do that?