CodePark/ questions / Replication, Sentinel & Cluster
START PRACTICINGPRACTICE
Backend question · Redis & caching › Replication, Sentinel & Cluster

How does Redis Cluster decide which node stores a key?

CRC16(key) mod 16384 gives a hash slot, and each primary owns a range of slots

Redis Cluster has a fixed set of 16,384 hash slots. Redis hashes the key with CRC16 and takes the result modulo 16384. If the key has a hash tag, Redis hashes only the tag. Each slot is assigned to one primary. This is not "Consistent hashing on a ring of virtual nodes". But both designs let you move data in small units when you reshard.