不连续的槽的我创建了一个redis的群集与三个节点:Redis的簇reshard后,大量分配给一个节点
~ redis-3.2.10/src/redis-trib.rb create 127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002
我然后加入第四节点和resharded使连时隙分配:
~ redis-3.2.10/src/redis-trib.rb add-node 127.0.0.1:7003 127.0.0.1:7000
~ redis-3.2.10/src/redis-trib.rb reshard --timeout 60000 127.0.0.1:7000
...
How many slots do you want to move (from 1 to 16384)? 4096
...
Source node #1:all
...
redis-3.2.10/src/redis-trib.rb check 127.0.0.1:7000
>>> Performing Cluster Check (using node 127.0.0.1:7000)
M: 29fbb7e5f93eac22a224c14d4070139919bb0a5e 127.0.0.1:7000
slots:1365-5460 (4096 slots) master
0 additional replica(s)
M: c90c9f590bb48d328f3eed2fc96af3a7d9cb0f25 127.0.0.1:7003
slots:0-1364,5461-6826,10923-12287 (4096 slots) master
0 additional replica(s)
M: 970b3145574a4f38bbe10548bf6b80f8fdc2854d 127.0.0.1:7001
slots:6827-10922 (4096 slots) master
0 additional replica(s)
M: 2cc0922fcfb3e619b6d733e054dd249a4b6137bf 127.0.0.1:7002
slots:12288-16383 (4096 slots) master
0 additional replica(s)
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.
然后,如果你缩减下来,reshard插槽从后面:7003节点到其余三个,你最终的东西,如:
>>> Performing Cluster Check (using node 127.0.0.1:7000)
M: 29fbb7e5f93eac22a224c14d4070139919bb0a5e 127.0.0.1:7000
slots:1365-5460,12288-13652 (5461 slots) master
0 additional replica(s)
M: 970b3145574a4f38bbe10548bf6b80f8fdc2854d 127.0.0.1:7001
slots:0-1364,5461-6826,10923-12287,13653-15017 (5461 slots) master
0 additional replica(s)
M: 2cc0922fcfb3e619b6d733e054dd249a4b6137bf 127.0.0.1:7002
slots:6827-10922,15018-16383 (5462 slots) master
0 additional replica(s)
M: c90c9f590bb48d328f3eed2fc96af3a7d9cb0f25 127.0.0.1:7003
slots: (0 slots) master
0 additional replica(s)
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.
:7001节点有4个不同的哈希槽分配给它。在后续重新分片之后,这个散列槽的“碎片”似乎会增加。
难道它会成为一个问题(性能或其他)有越来越多的哈希槽的碎片?
为什么最后一个节点有0个插槽? –
因为我刚刚将所有槽从该节点重新分配到其余三个槽中,以期将其从集群中移除。 –
如果您想要连续插入每个节点,请先制作单节点群集,然后在其中添加其他节点。我做了同样的事情。 –