启动redis cluster后运行check 检查到错误
[root@192.168.56.160 redis]redis-trib.rb check 127.0.0.1:7000
>>> Performing Cluster Check (using node 127.0.0.1:7000)
M: 3d1808df8a82dd705a67e8fef26cb8c8482bd69a 127.0.0.1:7000
slots:0-5459 (5460 slots) master
1 additional replica(s)
S: 6fa8513ee71e0153e2e746fef2a3b1ce08348766 192.168.56.159:7003
slots: (0 slots) slave
replicates a10cf2bdaf1c445c34d6ae447a2f79bc5d4e9c32
M: 36dc79859c644cb03e6c1b0ec4a2d8bf56cfa39c 192.168.56.160:7001
slots:10923-16383 (5461 slots) master
1 additional replica(s)
S: d057d13bc64b9be9f68c0291700965b3751127c0 192.168.56.159:7005
slots: (0 slots) slave
replicates 36dc79859c644cb03e6c1b0ec4a2d8bf56cfa39c
M: a10cf2bdaf1c445c34d6ae447a2f79bc5d4e9c32 192.168.56.160:7002
slots:5461-10922 (5462 slots) master
1 additional replica(s)
S: a84cb46e811925ee48f0ff8c25e753be752fc45c 192.168.56.159:7004
slots: (0 slots) slave
replicates 3d1808df8a82dd705a67e8fef26cb8c8482bd69a
[ERR] Nodes don't agree about configuration!
>>> Check for open slots...
>>> Check slots coverage...
[ERR] Not all 16384 slots are covered by nodes.
可以看到5460号slots没有被分配,根据网上攻略 fix
[root@192.168.56.160 redis]redis-trib.rb fix 127.0.0.1:7000
>>> Performing Cluster Check (using node 127.0.0.1:7000)
M: 3d1808df8a82dd705a67e8fef26cb8c8482bd69a 127.0.0.1:7000
slots:0-5459 (5460 slots) master
1 additional replica(s)
S: 6fa8513ee71e0153e2e746fef2a3b1ce08348766 192.168.56.159:7003
slots: (0 slots) slave
replicates a10cf2bdaf1c445c34d6ae447a2f79bc5d4e9c32
M: 36dc79859c644cb03e6c1b0ec4a2d8bf56cfa39c 192.168.56.160:7001
slots:10923-16383 (5461 slots) master
1 additional replica(s)
S: d057d13bc64b9be9f68c0291700965b3751127c0 192.168.56.159:7005
slots: (0 slots) slave
replicates 36dc79859c644cb03e6c1b0ec4a2d8bf56cfa39c
M: a10cf2bdaf1c445c34d6ae447a2f79bc5d4e9c32 192.168.56.160:7002
slots:5461-10922 (5462 slots) master
1 additional replica(s)
S: a84cb46e811925ee48f0ff8c25e753be752fc45c 192.168.56.159:7004
slots: (0 slots) slave
replicates 3d1808df8a82dd705a67e8fef26cb8c8482bd69a
[ERR] Nodes don't agree about configuration!
>>> Check for open slots...
>>> Check slots coverage...
[ERR] Not all 16384 slots are covered by nodes.
>>> Fixing slots coverage...
List of not covered slots: 5460
Slot 5460 has keys in 0 nodes:
The folowing uncovered slots have no keys across the cluster:
5460
Fix these slots by covering with a random node? (type 'yes' to accept): yes
>>> Covering slot 5460 with 192.168.56.160:7002
/usr/local/ruby/lib/ruby/gems/2.2.0/gems/redis-3.2.2/lib/redis/client.rb:114:in `call': ERR Slot 5460 is already busy (Redis::CommandError)
from /usr/local/ruby/lib/ruby/gems/2.2.0/gems/redis-3.2.2/lib/redis.rb:2646:in `block in method_missing'
from /usr/local/ruby/lib/ruby/gems/2.2.0/gems/redis-3.2.2/lib/redis.rb:57:in `block in synchronize'
from /usr/local/ruby/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
from /usr/local/ruby/lib/ruby/gems/2.2.0/gems/redis-3.2.2/lib/redis.rb:57:in `synchronize'
from /usr/local/ruby/lib/ruby/gems/2.2.0/gems/redis-3.2.2/lib/redis.rb:2645:in `method_missing'
from /usr/local/bin/redis-trib.rb:462:in `block in fix_slots_coverage'
from /usr/local/bin/redis-trib.rb:459:in `each'
from /usr/local/bin/redis-trib.rb:459:in `fix_slots_coverage'
from /usr/local/bin/redis-trib.rb:398:in `check_slots_coverage'
from /usr/local/bin/redis-trib.rb:361:in `check_cluster'
from /usr/local/bin/redis-trib.rb:1139:in `fix_cluster_cmd'
from /usr/local/bin/redis-trib.rb:1695:in `<main>'
进入到集群节点查看
192.168.56.160:7002> CLUSTER NODES
d057d13bc64b9be9f68c0291700965b3751127c0 192.168.56.159:7005 slave 36dc79859c644cb03e6c1b0ec4a2d8bf56cfa39c 0 1470880315004 6 connected
3d1808df8a82dd705a67e8fef26cb8c8482bd69a 192.168.56.160:7000 master - 0 1470880315505 1 connected 0-5460
36dc79859c644cb03e6c1b0ec4a2d8bf56cfa39c 192.168.56.160:7001 master - 0 1470880316013 2 connected 10923-16383
a84cb46e811925ee48f0ff8c25e753be752fc45c 192.168.56.159:7004 slave 3d1808df8a82dd705a67e8fef26cb8c8482bd69a 0 1470880316014 5 connected
a10cf2bdaf1c445c34d6ae447a2f79bc5d4e9c32 192.168.56.160:7002 myself,master - 0 0 7 connected 5461-10922
6fa8513ee71e0153e2e746fef2a3b1ce08348766 192.168.56.159:7003 slave a10cf2bdaf1c445c34d6ae447a2f79bc5d4e9c32 0 1470880313997 7 connected
发现5460号已经在7000端口上~~~不明白,删除掉
192.168.56.160:7002> CLUSTER DELSLOTS 5460
OK
192.168.56.160:7002> CLUSTER NODES
d057d13bc64b9be9f68c0291700965b3751127c0 192.168.56.159:7005 slave 36dc79859c644cb03e6c1b0ec4a2d8bf56cfa39c 0 1470880645436 6 connected
3d1808df8a82dd705a67e8fef26cb8c8482bd69a 192.168.56.160:7000 master - 0 1470880645937 1 connected 0-5459
36dc79859c644cb03e6c1b0ec4a2d8bf56cfa39c 192.168.56.160:7001 master - 0 1470880644932 2 connected 10923-16383
a84cb46e811925ee48f0ff8c25e753be752fc45c 192.168.56.159:7004 slave 3d1808df8a82dd705a67e8fef26cb8c8482bd69a 0 1470880646946 5 connected
a10cf2bdaf1c445c34d6ae447a2f79bc5d4e9c32 192.168.56.160:7002 myself,master - 0 0 7 connected 5461-10922
6fa8513ee71e0153e2e746fef2a3b1ce08348766 192.168.56.159:7003 slave a10cf2bdaf1c445c34d6ae447a2f79bc5d4e9c32 0 1470880646442 7 connected
再次fix
[root@192.168.56.160 redis]redis-trib.rb fix 127.0.0.1:7000
>>> Performing Cluster Check (using node 127.0.0.1:7000)
M: 3d1808df8a82dd705a67e8fef26cb8c8482bd69a 127.0.0.1:7000
slots:0-5459 (5460 slots) master
1 additional replica(s)
S: 6fa8513ee71e0153e2e746fef2a3b1ce08348766 192.168.56.159:7003
slots: (0 slots) slave
replicates a10cf2bdaf1c445c34d6ae447a2f79bc5d4e9c32
M: 36dc79859c644cb03e6c1b0ec4a2d8bf56cfa39c 192.168.56.160:7001
slots:10923-16383 (5461 slots) master
1 additional replica(s)
S: d057d13bc64b9be9f68c0291700965b3751127c0 192.168.56.159:7005
slots: (0 slots) slave
replicates 36dc79859c644cb03e6c1b0ec4a2d8bf56cfa39c
M: a10cf2bdaf1c445c34d6ae447a2f79bc5d4e9c32 192.168.56.160:7002
slots:5461-10922 (5462 slots) master
1 additional replica(s)
S: a84cb46e811925ee48f0ff8c25e753be752fc45c 192.168.56.159:7004
slots: (0 slots) slave
replicates 3d1808df8a82dd705a67e8fef26cb8c8482bd69a
[ERR] Nodes don't agree about configuration!
>>> Check for open slots...
>>> Check slots coverage...
[ERR] Not all 16384 slots are covered by nodes.
>>> Fixing slots coverage...
List of not covered slots: 5460
Slot 5460 has keys in 0 nodes:
The folowing uncovered slots have no keys across the cluster:
5460
Fix these slots by covering with a random node? (type 'yes' to accept): yes
>>> Covering slot 5460 with 192.168.56.160:7002
再次check
[root@192.168.56.160 redis]redis-trib.rb check 127.0.0.1:7000
>>> Performing Cluster Check (using node 127.0.0.1:7000)
M: 3d1808df8a82dd705a67e8fef26cb8c8482bd69a 127.0.0.1:7000
slots:0-5459 (5460 slots) master
1 additional replica(s)
S: 6fa8513ee71e0153e2e746fef2a3b1ce08348766 192.168.56.159:7003
slots: (0 slots) slave
replicates a10cf2bdaf1c445c34d6ae447a2f79bc5d4e9c32
M: 36dc79859c644cb03e6c1b0ec4a2d8bf56cfa39c 192.168.56.160:7001
slots:10923-16383 (5461 slots) master
1 additional replica(s)
S: d057d13bc64b9be9f68c0291700965b3751127c0 192.168.56.159:7005
slots: (0 slots) slave
replicates 36dc79859c644cb03e6c1b0ec4a2d8bf56cfa39c
M: a10cf2bdaf1c445c34d6ae447a2f79bc5d4e9c32 192.168.56.160:7002
slots:5460-10922 (5463 slots) master
1 additional replica(s)
S: a84cb46e811925ee48f0ff8c25e753be752fc45c 192.168.56.159:7004
slots: (0 slots) slave
replicates 3d1808df8a82dd705a67e8fef26cb8c8482bd69a
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.
查看CLUSTER NODES
192.168.56.160:7002> CLUSTER NODES
d057d13bc64b9be9f68c0291700965b3751127c0 192.168.56.159:7005 slave 36dc79859c644cb03e6c1b0ec4a2d8bf56cfa39c 0 1470881435270 6 connected
3d1808df8a82dd705a67e8fef26cb8c8482bd69a 192.168.56.160:7000 master - 0 1470881434766 1 connected 0-5459
36dc79859c644cb03e6c1b0ec4a2d8bf56cfa39c 192.168.56.160:7001 master - 0 1470881435771 2 connected 10923-16383
a84cb46e811925ee48f0ff8c25e753be752fc45c 192.168.56.159:7004 slave 3d1808df8a82dd705a67e8fef26cb8c8482bd69a 0 1470881435270 5 connected
a10cf2bdaf1c445c34d6ae447a2f79bc5d4e9c32 192.168.56.160:7002 myself,master - 0 0 7 connected 5460-10922
6fa8513ee71e0153e2e746fef2a3b1ce08348766 192.168.56.159:7003 slave a10cf2bdaf1c445c34d6ae447a2f79bc5d4e9c32 0 1470881436274 7 connected
5460已经属于7003端口
总结:虽然check已经OK,总感觉处理过程怪怪的~~没有找到正确的处理步骤,自己猜测执行的~~继续学习!!