Skip to main content

What is Redis Cluster?

Redis Cluster is a Redis mode where data is automatically distributed across several nodes (server instances), to provide scaling and fault tolerance.

The core idea

In plain Redis, all data lives on a single server. In Redis Cluster, keys are split across nodes by hash slots (16384 slots in total). Every master node is responsible for a specific range of slots.

Example:

javascript
master1 → slots 0-5460 master2 → slots 5461-10922 master3 → slots 10923-16383

Architecture

  • Every master holds part of the data.
  • Every master has one or several replicas.
  • Replicas automatically take on the master role if the primary node fails.

So:

javascript
master1 → replica1 master2 → replica2 master3 → replica3

How this works

  1. The client connects to any node in the cluster.
  2. The node figures out which slot the key belongs to (via the CRC16 hash function).
  3. If that slot belongs to a different master, it returns a MOVED response, and the client is redirected to the right node.
  4. If a master fails, one of its replicas automatically becomes the new master.

What Redis Cluster gives you

  • Horizontal scaling, nodes can be added, and data gets redistributed.
  • Fault tolerance, if a master fails, its replica takes over.
  • Automatic routing, clients know where to look for a given key.

Limitations

  • Not every command is supported (e.g. MULTI/EXEC with several keys spread across different slots).
  • It requires a properly cluster-aware client driver.
  • Some data can become temporarily unavailable if a master and all its replicas fail.

Summary

Redis Cluster is a distributed system built into Redis, where data is split into 16384 slots across several masters with replicas, providing scaling, fault tolerance, and automatic recovery with no external tools like Sentinel needed.

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.