redis教程

redis 命令,redis入门指南,redis 安装,redis教程,redis视频教程,redis pdf电子书下载,redis免费视频教程,redis视频教程下载

redis新增集群节点-redis集群管理

2016-07-21| 发布: | 浏览: 1345 |保存PDF

新增一个节点6383,并启动


执行redis-trib.rb add-node命令添加节点

redis-trib.rb add-node  new_host:new_port existing_host:existing_port
[root@master redis-cluster]# /opt/redis/redis-3.2.1/src/redis-trib.rb add-node 192.168.56.101:6383 192.168.56.101:6380
>>> Adding node 192.168.56.101:6383 to cluster 192.168.56.101:6380
>>> Performing Cluster Check (using node 192.168.56.101:6380)
M: ecaef90fb93d61edd7522221136be88ae66ad3bc 192.168.56.101:6380
   slots:0-5460 (5461 slots) master
   0 additional replica(s)
M: 52953677dbc82dc4f17b33a922b38462944b002c 192.168.56.101:6382
   slots:10923-16383 (5461 slots) master
   0 additional replica(s)
M: c6e6b65324fac0711a22439d264cca141d2e5082 192.168.56.101:6381
   slots:5461-10922 (5462 slots) master
   0 additional replica(s)
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.
>>> Send CLUSTER MEET to node 192.168.56.101:6383 to make it join the cluster.
[OK] New node added correctly.


查看集群信息:

192.168.56.101:6382> cluster nodes
03596d92625f1b778f29eb4a9128d92809dfd79a 192.168.56.101:6381 master - 0 1468853934619 2 connected 5461-10922
e6d316a0dcd7cfcc98de645d86989d5527e86e55 192.168.56.101:6383 master - 0 1468853932181 0 connected
b1939026deb80fedde7bdb22c1df3ecfaa72f608 192.168.56.101:6380 master - 0 1468853933604 1 connected 0-5460
6aa027917d223b8fedd42893a89fb0e2c07c8b27 192.168.56.101:6382 myself,master - 0 0 3 connected 10923-16383


发现刚添加进来的6383没有插槽数,接下来给新添加的6383分配插槽,将集群中的一部分(1000个)插槽分配给6383

[root@master redis-cluster]# /opt/redis/redis-3.2.1/src/redis-trib.rb reshard 192.168.56.101:6380
>>> Performing Cluster Check (using node 192.168.56.101:6380)
M: b1939026deb80fedde7bdb22c1df3ecfaa72f608 192.168.56.101:6380
   slots:0-5460 (5461 slots) master
   0 additional replica(s)
M: 6aa027917d223b8fedd42893a89fb0e2c07c8b27 192.168.56.101:6382
   slots:10923-16383 (5461 slots) master
   0 additional replica(s)
M: 03596d92625f1b778f29eb4a9128d92809dfd79a 192.168.56.101:6381
   slots:5461-10922 (5462 slots) master
   0 additional replica(s)
M: e6d316a0dcd7cfcc98de645d86989d5527e86e55 192.168.56.101:6383
   slots: (0 slots) master
   0 additional replica(s)
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.
How many slots do you want to move (from 1 to 16384)? 1000【要移动的插槽数】
What is the receiving node ID? e6d316a0dcd7cfcc98de645d86989d5527e86e55【接收节点】
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.【数据要提到slot的节点ID,最后用done结束】
Source node #1:all
......
Do you want to proceed with the proposed reshard plan (yes/no)? yes
......





重新查看集群节点信息

192.168.56.101:6382> cluster nodes
03596d92625f1b778f29eb4a9128d92809dfd79a 192.168.56.101:6381 master - 0 1468855258984 2 connected 5795-10922
e6d316a0dcd7cfcc98de645d86989d5527e86e55 192.168.56.101:6383 master - 0 1468855261016 4 connected 0-332 5461-5794 10923-11255
b1939026deb80fedde7bdb22c1df3ecfaa72f608 192.168.56.101:6380 master - 0 1468855260001 1 connected 333-5460
6aa027917d223b8fedd42893a89fb0e2c07c8b27 192.168.56.101:6382 myself,master - 0 0 3 connected 11256-16383


书生参考网络整理


宝贝推荐

系列教程

大家都在看

热门访问