redis集群缩容

一:缩容步骤

#重新分配槽
redis-cli --cluster reshard 10.0.0.101:6380

#第一次交互:需要迁移多少个槽
How many slots do you want to move (from 1 to 16384)? 1365(4096/3)

#第三次交互:接受节点ID是多少
What is the receiving node ID? 10.0.0.101的6380的ID

#第三次交互:哪些节点需要导出
Please enter all the source node IDs.
Type 'all' to use all the nodes as source nodes for the hash slots.
Type 'done' once you entered all the source nodes IDs.
Source node #1: 6390的ID
Source node #2: done

#第四次交互:确认信息
Do you want to proceed with the proposed reshard plan (yes/no)? yes

重复上述操作,知道6390所有的槽都被分配完毕

二:检查
redis-cli --cluster info 10.0.0.101:6380

三:将缩容后的节点下线
redis-cli --cluster del-node 10.0.0.101:6391 65e48c2992f28ab723dd0af718e2695b6977826d 6391的ID
redis-cli --cluster del-node 10.0.0.101:6390 537abf4ce08e9b79cd38636619838e17131e4c68 6390的ID
四:利用集群重新负载均衡命令重新分配
redis-cli --cluster rebalance 10.0.0.101:6380

posted on 2021-07-12 20:14  弓长三寿  阅读(287)  评论(0编辑  收藏  举报