其他 添加节点
redis-trib.rb add-node 新节点 旧节点(集群任意节点)
添加节点为指点节点的从节点
redis-trib.rb add-node --slave--master-id '304f069a63299b……(master节点id)' 新节点 127.0.0.1:6380(集群任意节点) 重新分配slot
redis-trib.rb reshard192.168.10.219:6378 //下面是主要过程
How many slots do you want to move(from 1 to 16384)? 1000 //设置slot数1000
What is the receiving node>
node> Type 'all' to use all the nodes assource nodes for the hash slots.
Type 'done' once you entered all thesource nodes> Source node #1:all //表示全部节点重新洗牌
Do you want to proceed with the proposedreshard plan (yes/no)? yes //确认重新分 删除节点
1,删除从节点
# redis-trib.rb del-node 192.168.0.131:6381 '304f069a63299bf4b20d2f018a3b2c3bba650a53'
2,删除主节点
如果主节点有从节点,将从节点转移到其他主节点
如果主节点有slot,去掉分配的slot,然后在删除主节点
redis-trib.rb reshard192.168.0.131:6381 //取消分配的slot,下面是主要过程
How many slots do you want to move (from 1to 16384)? 1000 //被删除master的所有slot数量
What is the receiving node>
Please enter all the source node> Type 'all' to use all the nodes as sourcenodes for the hash slots.
Type 'done' once you entered all the sourcenodes> Source node#1:304f069a63299bf4b20d2f018a3b2c3bba650a53 //被删除master的node-id
Source node #2:done
Doyou want to proceed with the proposed reshard plan (yes/no)? yes //取消slot后,reshard
新增master节点后,也进行了这一步操作,当时是分配,现在去掉。反着的。
# redis-trib.rb del-node192.168.0.131:6381 '304f069a63299bf4b20d2f018a3b2c3bba650a53'
参考链接:redis知识库