Redis Cluster: 16384 hash slots, built-in failover via gossip, MOVED/ASK redirects, online resharding - NO Sentinel needed
Redis Cluster is the native distributed mode of Redis. It automatically partitions data across multiple master nodes using 16384 hash slots. Unlike Redis Sentinel (which is HA-only), Redis Cluster provides both sharding AND built-in failover -- no external process needed.
Redis Cluster uses "smart clients" (redis-py, jedis, ioredis) that maintain a local cache of the hash slot to node mapping. The client computes CRC16(key) % 16384 to determine which master owns a key, then sends the command directly. No proxy is needed.
Each master owns roughly 1/3 of the 16384 hash slots.
Every Redis Cluster node opens a second TCP port (main port + 10000, e.g. 16379) for node-to-node communication. Nodes exchange PING/PONG messages carrying cluster metadata, failure reports, and configuration updates.
slot = CRC16(key) % 16384
The client computes this locally and routes directly. On first connect, the client runs CLUSTER SLOTS to get the full mapping.
| Redirect | Meaning | Client Action |
|---|---|---|
| MOVED | Slot permanently lives on another node | Update cache, retry |
| ASK | Slot is being migrated, try the other node | Send ASKING + retry, do NOT update cache |
MOVED = permanent reassignment. ASK = temporary during migration.
Similar to Sentinel's SDOWN/ODOWN but built into the cluster:
When a master is marked FAIL:
currentEpoch (logical clock)Slots can be moved between masters while the cluster is running:
MIGRATE command)