A Layer of Indirection
Some clustered stores like Redis Cluster do not hash keys straight to nodes. Instead they define a fixed number of hash slots, commonly sixteen thousand three hundred eighty four. Each key hashes to a slot, and each slot is assigned to a node.
How a Key Finds Its Node
- Compute a hash of the key and take it modulo the slot count to get a slot number.
- Look up which node currently owns that slot.
- Send the request to that node.
This indirection means the key to slot mapping never changes, only the slot to node mapping does.
Rebalancing
To rebalance you move whole slots between nodes. Migration happens slot by slot, and the cluster tracks which slots are in transit so clients can be redirected. Because slots are discrete units, operators can plan moves precisely.
Hash Tags
If two keys must live on the same node, you wrap a common substring in braces so only that part is hashed, forcing them into the same slot.
Key idea
A fixed pool of hash slots sits between keys and nodes, so rebalancing moves discrete slots rather than rehashing keys, making cluster changes predictable and controllable.