Redis › Cluster Sharding & Hash Slots
How do you check the current distribution of hash slots and keys across the nodes in a Redis Cluster to identify potential imbalances?
IntermediateAnswer
You use the CLUSTER SLOTS or CLUSTER SHARDS command to see exactly which node owns which range of hash slots, and combine this with checking key counts per node, to identify if certain nodes are holding significantly more data or slots than others, which could indicate an imbalance worth addressing through resharding.
redis-cli cluster slots
redis-cli -h node1 dbsize
redis-cli -h node2 dbsizeReal-world example A database administrator notices one node in their cluster holding twice as much data as the others after checking slot distribution and key counts, prompting a resharding operation to better balance the load.