How would you plan and execute resharding a Redis Cluster to add a new node and redistribute existing hash slots?
Short answer
You add the new node to the cluster, then use a resharding tool or command to move a portion of hash slots, and the keys within them, from existing nodes to the new node, carefully doing this gradually to avoid overwhelming the cluster with data migration traffic while it…
Advertisement
AModel answer
You add the new node to the cluster, then use a resharding tool or command to move a portion of hash slots, and the keys within them, from existing nodes to the new node, carefully doing this gradually to avoid overwhelming the cluster with data migration traffic while it continues serving live production requests.
Example
redis-cli --cluster add-node newnode:6379 existingnode:6379 redis-cli --cluster reshard existingnode:6379
Real-world example
A growing e-commerce platform adds a fourth node to their three node Redis Cluster during a low traffic period, gradually resharding slots to the new node to spread out the increasing data volume without disrupting the live shopping experience.
Likely follow-ups
- How long does resharding typically take for a large amount of data?
- What precautions should be taken before starting a resharding operation in production?
Related topics