redis cluster add node失败[err]不是所有16384个插槽都被节点覆盖

ffscu2ro  于 2021-06-09  发布在  Redis
关注(0)|答案(1)|浏览(426)

我有6个节点的redis集群(3个主节点,3个从节点)。我正在尝试添加额外的主设备和从设备:

redis-cli --cluster add-node 100.96.1.11:6379 100.96.2.14:6379

我有

redis-cli --cluster add-node 100.96.1.11:6379 100.96.2.14:6379
>>> Adding node 100.96.1.11:6379 to cluster 100.96.2.14:6379
>>> Performing Cluster Check (using node 100.96.2.14:6379)
M: 9d91c8d60c4c644a7846829f91f1af8563bf99f9 100.96.2.14:6379
   slots: (0 slots) master
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[ERR] Not all 16384 slots are covered by nodes.

同时检查集群是否正常:

redis-cli --cluster check 100.96.1.5:6379
100.96.1.5:6379 (d475435a...) -> 36265 keys | 5462 slots | 1 slaves.
100.96.1.7:6379 (fd44a251...) -> 36205 keys | 5461 slots | 1 slaves.
100.96.2.13:6379 (00cc3a8b...) -> 36069 keys | 5461 slots | 1 slaves.
[OK] 108539 keys in 3 masters.
6.62 keys per slot on average.
>>> Performing Cluster Check (using node 100.96.1.5:6379)
M: d475435a6e70a5603f046f743f7774e6eead6afe 100.96.1.5:6379
   slots:[5461-10922] (5462 slots) master
   1 additional replica(s)
S: 2c66b6ab6ebacd6054371bdc5d39aa08c48f76b5 100.96.1.10:6379
   slots: (0 slots) slave
   replicates 00cc3a8ba8cae1b539e172be01333b6f5fb2631a
M: fd44a251ce75c92049d1a5c748a8e52c2b0763e0 100.96.1.7:6379
   slots:[10923-16383] (5461 slots) master
   1 additional replica(s)
M: 00cc3a8ba8cae1b539e172be01333b6f5fb2631a 100.96.2.13:6379
   slots:[0-5460] (5461 slots) master
   1 additional replica(s)
S: edcacf3cd1de6c5d9a3108211c7b84676b2cddca 100.96.2.9:6379
   slots: (0 slots) slave
   replicates fd44a251ce75c92049d1a5c748a8e52c2b0763e0
S: e6cea582a6d6a9c726d36d2899c9fbf4a7e08909 100.96.2.6:6379
   slots: (0 slots) slave
   replicates d475435a6e70a5603f046f743f7774e6eead6afe
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.

怎么了?

csbfibhn

csbfibhn1#

要将新节点添加到redis群集,应使用以下命令:

redis-cli --cluster add-node <new-node-ip:port> <existing-node-ip:port>

在我的例子中,有两个新节点的ip。因此,如果我们需要添加两个新节点作为主节点和从节点,我们应该运行这个命令两次,但是使用 --cluster-slave 从机标志:

redis-cli --cluster add-node <new-node-ip:port> <existing-node-ip:port>
redis-cli --cluster add-node <new-node-ip:port> <existing-node-ip:port> --cluster-slave

在那之后,我们应该重新部署redis集群:

redis-cli --cluster reshard <existing-node-ip:port>

相关问题