#3.4、给新添加的7006节点分配哈希槽
cd /data/soft/redis/src/
./redis-trib.rb reshard 127.0.0.1:7000
#3.4.1、根据提示选择要迁移的slot数量(ps:这里选择1000)
How many slots do you want to move (from 1 to 16384)? 1000
#3.4.2、选择要接受这些slot的node-id(ps:这里选择7006节点的node-id)
What is the receiving node ID? cee383ab949eeb33d58aacde89c9cfb8eaa65eab
#3.4.3、选择slot来源:
#all表示从所有的master重新分配,
#或者数据要提取slot的master节点id,最后用done结束(ps:这里只选择了7000节点的slot)
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:721d0479cbd308eac871b2abe3b5805db80d2fe3
Source node #2:done
#3.4.4、打印被移动的slot后,输入yes开始移动slot以及对应的数据。
Do you want to proceed with the proposed reshard plan (yes/no)? yes
#6、删除一个Master节点(这里以7006节点为例 )
#6.1、删除master节点之前首先要使用reshard移除master的全部slot
cd /data/soft/redis/src/
./redis-trib.rb reshard 127.0.0.1:7006
#6.1.1、根据提示选择要迁移的slot数量(ps:这里选择1000)
How many slots do you want to move (from 1 to 16384)? 1000
#6.1.2、选择要接受这些slot的node-id(ps:这里选择7000节点的node-id)
What is the receiving node ID? 721d0479cbd308eac871b2abe3b5805db80d2fe3
#6.1.3、选择slot来源:
#all表示从所有的master重新分配,
#或者数据要提取slot的master节点id,最后用done结束(ps:这里选择需要要删除的7006节点slot)
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:cee383ab949eeb33d58aacde89c9cfb8eaa65eab
Source node #2:done
#6.1.4、打印被移动的slot后,输入yes开始移动slot以及对应的数据。
Do you want to proceed with the proposed reshard plan (yes/no)? yes
#6.2、删除空7006节点
cd /data/soft/redis/src/
./redis-trib.rb del-node 127.0.0.1:7006 'cee383ab949eeb33d58aacde89c9cfb8eaa65eab'