How does Redis Cluster scale horizontally?
Redis Cluster scales horizontally by distributing keys across a set of nodes (masters), each of which holds part of the overall dataset.
Here's how this is set up:
1. Data is split into 16384 hash slots
-
Redis Cluster splits the whole key space into 16384 logical slots.
-
Every master node gets a certain number of these slots. For example:
javascriptmaster1 → 0-5460 master2 → 5461-10922 master3 → 10923-16383 -
When a client writes or reads a key, Redis computes its hash (
CRC16(key) % 16384) and figures out which slot it belongs to.
The result: every node holds only part of the data, not the whole volume.
2. Adding new nodes
As data grows:
- an administrator adds a new node (a master) to the cluster,
- and Redis redistributes some of the slots from the existing masters onto it.
This is done via the command:
redis-cli --cluster reshard <host>:<port>During migration, data is automatically moved between nodes, with no need to stop the cluster.
3. Load balancing
Every node holds roughly the same number of slots, so memory and operation load is spread evenly.
If some node is overloaded, slots can be moved manually or automatically.
4. Reading from replicas
Every master has one or several replicas, which can be used to scale reads. So:
master → writes
replicas → reads5. Scaling with no single point of failure
Redis Cluster has no central coordinator: every node knows how the slots are distributed and can redirect requests to each other.
The client connects to any node, and if needed, that node returns a MOVED command, pointing to the right node.
Summary
Redis Cluster scales horizontally because it lets you add new nodes, redistributing hash slots and data among them.
This provides:
- linear performance growth as servers are added,
- evenly spread load,
- and fault tolerance through replicas.
Short Answer
Interview readyA concise answer to help you respond confidently on this topic during an interview.