一、前言
因业务需要扩容,考虑到集群单实例容量已经超过10GB,算是比较大的情况了。所以不能直接调整maxmemory参数进行扩容,需要加节点动态扩容。
业务集群版本是3.0.7版本的。
二、操作
2.1 模拟和执行
在对3.0.7版带密码的集群加好新主从,模拟迁槽位没有问题:
./redis-trib.rb rebalance --password "xxx" --use-empty-masters --simulate xx:xx1
...
...
但是真正执行的时候出问题了:
./redis-trib.rb rebalance --password "xxx" --use-empty-masters xx:xx1
>>> Performing Cluster Check (using node xx:xx1)
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
[WARNING] Node xx:xx1 has slots in migrating state (13107).
[WARNING] Node xx:xx2 has slots in importing state (13107).
[WARNING] The following slots are open: 13107
>>> Check slots coverage...
[OK] All 16384 slots covered.
*** Please fix your cluster problems before rebalancing
错误输出提示需要先 fix 集群的问题才能继续做rebalance操作。
2.2 fix
进行fix操作
./redis-trib.rb fix --password "xxx" xx:xx1
>>> Fixing open slot 13107
Set as migrating in: xx:xx1
Set as importing in: xx:xx2
Moving slot 13107 from xx:xx to xx:xx1:
[ERR] Calling MIGRATE: ERR s