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

← All Databases & Caching questions