1. Cluster state
CLUSTER INFO reports overall cluster health, such as whether the cluster is up and how many slots are assigned.
CLUSTER INFOTyporithm · hard
Step 1 of 8 · intro card
Persistence & Scale
Redis Cluster shards data across 16384 hash slots; a key maps to a slot via CRC16 mod 16384 (CLUSTER KEYSLOT shows it). Each master owns a slot range, and CLUSTER NODES/SLOTS/INFO introspect the topology while ADDSLOTS assigns slots. Multi-key operations must share a slot, which you force with hash tags like {user:1}.
Redis Cluster partitions the keyspace into 16384 hash slots and spreads them across master nodes. A key's slot is CRC16 of the key modulo 16384, and CLUSTER KEYSLOT user:1 shows exactly which slot a given key lands in.
Each master owns a contiguous range of slots. CLUSTER INFO reports cluster health, CLUSTER NODES lists every node with its slot ranges, and CLUSTER SLOTS returns the slot-to-node mapping. CLUSTER ADDSLOTS 0 1 2 assigns specific slots to the current node when you build or rebalance a cluster.
Because a multi-key command only works if all keys live in the same slot, you use hash tags: wrapping part of the key in braces, like {user:1}:profile and {user:1}:cart, makes only the braced portion hash, forcing those keys into one slot.
Cluster shards data across 16384 hash slots.
Key slot = CRC16(key) mod 16384 (CLUSTER KEYSLOT).
Multi-key ops need one slot — use hash tags like {user:1}.
CLUSTER INFO
CLUSTER NODES
CLUSTER KEYSLOT user:1
CLUSTER ADDSLOTS 0 1 2
CLUSTER SLOTSConnect each part of the code to the concept before you type.
CLUSTER INFO reports overall cluster health, such as whether the cluster is up and how many slots are assigned.
CLUSTER INFOCLUSTER NODES lists every node, its role, and the hash-slot ranges it owns.
CLUSTER NODESCLUSTER KEYSLOT shows which of the 16384 slots a key maps to via CRC16 mod 16384.
CLUSTER KEYSLOT user:1CLUSTER ADDSLOTS assigns the listed hash slots to the current node.
CLUSTER ADDSLOTS 0 1 2CLUSTER SLOTS returns the mapping of slot ranges to the masters and replicas serving them.
CLUSTER SLOTSRead the concept map and follow the code breakdown.
Type the implementation, repair mistakes and work through every recall exercise.
Use the final check without hints; revisit weak concepts in short practice sessions.