1.redis集群扩容分配槽过程被打断。
[root@mongo-01 src]# ./redis-trib.rb reshard 10.0.0.114:6380

[root@mongo-01 src]# ./redis-trib.rb reshard 10.0.0.114:6380



登录两个库查看发现异常故执行fix修复命令
[root@mongo-01 src]# ./redis-trib.rb fix 10.0.0.114:6380

[root@mongo-01 src]# ./redis-trib.rb info 10.0.0.114:6380
10.0.0.114:6380 (349cda52...) -> 0 keys | 5461 slots | 1 slaves.
10.0.0.116:6380 (bb3becf6...) -> 0 keys | 5461 slots | 1 slaves.
10.0.0.114:6391 (1c755430...) -> 0 keys | 0 slots | 0 slaves.
10.0.0.114:6390 (3cc289c6...) -> 0 keys | 994 slots | 0 slaves.
10.0.0.115:6380 (d69f195d...) -> 0 keys | 4468 slots | 1 slaves.
[OK] 0 keys in 5 masters.
0.00 keys per slot on average.
[root@mongo-01 src]# ./redis-trib.rb check 10.0.0.114:6380

oot@mongo-01 src]# ./redis-trib.rb rebalance 10.0.0.114:6380
[root@mongo-01 src]# ./redis-trib.rb info 10.0.0.114:6380
10.0.0.114:6380 (349cda52...) -> 0 keys | 4096 slots | 1 slaves.
10.0.0.116:6380 (bb3becf6...) -> 0 keys | 4096 slots | 1 slaves.
10.0.0.114:6391 (1c755430...) -> 0 keys | 0 slots | 0 slaves.
10.0.0.114:6390 (3cc289c6...) -> 0 keys | 4096 slots | 0 slaves.
10.0.0.115:6380 (d69f195d...) -> 0 keys | 4096 slots | 1 slaves.
[OK] 0 keys in 5 masters.
0.00 keys per slot on average.
修复成功!!!!
解决方法二
1.在两个问题节点执行
CLUSTER SETSLOT <slot> STABLE 命令
取消对槽 slot 的导入(import)或者迁移(migrate)。
2.这个时候发现槽同时存在两个库上,只能选择丢弃这个槽内的数据,在两个节点都卸载这个槽
CLUSTER DELSLOTS <slot> [slot ...]
3.CLUSTER ADDSLOTS <slot> [slot ...],将卸载的槽添加至集群,集群恢复正常
网友评论