redisredis-cluster

Redis cluster: How to fix "... has slots in importing state. ... The following slots are open"?


I added a new empty node to the masters of my redis cluster, and it was fine (with no slots at first).

So I executed ths below command to reshard the cluster to distribute the slots to this new node, too; it was doing it, but in the middle, it was interrupted at some slot (5461 to be specific). (I don't have that output to show it here).

redis-cli --user default --cluster  reshard  192.168.56.110:6379  --cluster-from all --cluster-to 0ddc62c0074565b95e6232cce975be8856a2a1de --cluster-slots 4096  --cluster-yes

But the thing is, when I wanted to again, run the above command, it gives me the following error:

>>> Performing Cluster Check (using node 192.168.56.110:6379)
M: 0bc493fa7242fbc403c9c180729a1a4da6c594f1 192.168.56.110:6379
   slots:[0-5460] (5461 slots) master
M: 576ef5bb7bb8c245431038684b587d94ed3bdaf7 192.168.56.112:6379
   slots:[10923-16383] (5461 slots) master
M: 0ddc62c0074565b95e6232cce975be8856a2a1de 192.168.56.113:6379
   slots: (0 slots) master
M: 1c2a770d0be92796889a3c6b8c5c333d744d18ec 192.168.56.111:6379
   slots:[5461-10922] (5462 slots) master
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
[WARNING] Node 192.168.56.113:6379 has slots in importing state 5461.
[WARNING] The following slots are open: 5461.
>>> Check slots coverage...
[OK] All 16384 slots covered.
*** Please fix your cluster problems before resharding

How to solve this "open slot" ?


Solution

  • Thanks to U880D who gave me the official documentation of the case, I'll put the short answer here:

    redis-cli --cluster fix <any-master-node-ip>:<node-port>
    

    This will fix the cluster (reverts those slots to their previous state), so you have to run your reshard command again after it.