redis节点管理-节点的移除
原文:http://blog.sina.com.cn/s/blog_53b45c4d0102wg13.html
节点的移除
和节点添加一样,移除节点也有移除主节点,从节点。
1、移除主节点
移除节点使用redis-trib的del-node命令,
- redis-trib del-node 127.0.0.1:7002 ${node-id}
127.0.0.1:7002位集群节点,node-id为要删除的主节点。 和添加节点不同,移除节点node-id是必需的,测试删除7001主节点:
- [root@localhost redis-cluster]# ./redis-trib.rb del-node 127.0.0.1:7001 dd19221c404fb2fc4da37229de56bab755c76f2b
- >>> Removing node dd19221c404fb2fc4da37229de56bab755c76f2b from cluster 127.0.0.1:7002
- [ERR] Node 127.0.0.1:7001 is not empty! Reshard data away and try again.
- [root@localhost redis-cluster]#
redis cluster提示7001已经有数据了,不能够被删除,需要将他的数据转移出去,也就是和新增主节点一样需重新分片。
- [root@localhost redis-cluster]# ./redis-trib.rb reshard 127.0.0.1:7002
执行以后会提示我们移除的大小,因为7001占用了4096个槽点
- >>> Check for open slots...
- >>> Check slots coverage...
- [OK] All 16384 slots covered.
- How many slots do you want to move (from 1 to 16384)?
输入4096
提示移动的node id,填写7009的node id。(这里好像有误,应该填移动到的node id)
- How many slots do you want to move (from 1 to 16384)? 4096
- What is the receiving node ID? (接收的nodeid)
需要移动到全部主节点上还是单个主节点(这里好像有误,需要移动的的节点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:
将4096个槽点移动到7009上,填写7001的node id :dd19221c404fb2fc4da37229de56bab755c76f2b
- Source node #1:dd19221c404fb2fc4da37229de56bab755c76f2b
- Source node #2:done
- Do you want to proceed with the proposed reshard plan (yes/no)? yes
确认之后会一个一个将7001的卡槽移到到7009上。
- [root@localhost redis-cluster]# ./redis-trib.rb check 127.0.0.1:7009
- >>> Performing Cluster Check (using node 127.0.0.1:7009)
- M: 1f51443ede952b98724fea2a12f61fe710ab6cb1 127.0.0.1:7009
- slots:0-6826,10923-12287 (8192 slots) master
- 3 additional replica(s)
- S: ee3efb90e5ac0725f15238a64fc60a18a71205d7 127.0.0.1:7007
- slots: (0 slots) slave
- replicates 1f51443ede952b98724fea2a12f61fe710ab6cb1
- S: 50ce1ea59106b4c2c6bc502593a6a7a7dabf5041 127.0.0.1:7004
- slots: (0 slots) slave
- replicates 1f51443ede952b98724fea2a12f61fe710ab6cb1
- M: f9886c71e98a53270f7fda961e1c5f730382d48f 127.0.0.1:7003
- slots:12288-16383 (4096 slots) master
- 1 additional replica(s)
- M: dd19221c404fb2fc4da37229de56bab755c76f2b 127.0.0.1:7001
- slots: (0 slots) master
- 0 additional replica(s)
- S: 2ab1b061c36f30ae35604e9a171ae3afdc3c87e5 127.0.0.1:7008
- slots: (0 slots) slave
- replicates 1f51443ede952b98724fea2a12f61fe710ab6cb1
- S: 1f07d76585bfab35f91ec711ac53ab4bc00f2d3a 127.0.0.1:7002
- slots: (0 slots) slave
- replicates a5db243087d8bd423b9285fa8513eddee9bb59a6
- S: 8bb3ede48319b46d0015440a91ab277da9353c8b 127.0.0.1:7006
- slots: (0 slots) slave
- replicates f9886c71e98a53270f7fda961e1c5f730382d48f
- M: a5db243087d8bd423b9285fa8513eddee9bb59a6 127.0.0.1:7005
- slots:6827-10922 (4096 slots) master
- 1 additional replica(s)
- [OK] All nodes agree about slots configuration.
- >>> Check for open slots...
- >>> Check slots coverage...
- [OK] All 16384 slots covered.
- [root@localhost redis-cluster]#
可以看到7001有0个卡槽,而7009有8192个卡槽。
在执行移除操作
- [root@localhost redis-cluster]# ./redis-trib.rb del-node 127.0.0.1:7002 dd19221c404fb2fc4da37229de56bab755c76f2b
- >>> Removing node dd19221c404fb2fc4da37229de56bab755c76f2b from cluster 127.0.0.1:7002
- >>> Sending CLUSTER FORGET messages to the cluster...
- >>> SHUTDOWN the node.
- [root@localhost redis-cluster]#
已经删除了7001节点。
- [root@localhost redis-cluster]# ./redis-trib.rb check 127.0.0.1:7001
- [ERR] Sorry, can't connect to node 127.0.0.1:7001
- [root@localhost redis-cluster]# ./redis-trib.rb check 127.0.0.1:7009
- >>> Performing Cluster Check (using node 127.0.0.1:7009)
- M: 1f51443ede952b98724fea2a12f61fe710ab6cb1 127.0.0.1:7009
- slots:0-6826,10923-12287 (8192 slots) master
- 3 additional replica(s)
- S: ee3efb90e5ac0725f15238a64fc60a18a71205d7 127.0.0.1:7007
- slots: (0 slots) slave
- replicates 1f51443ede952b98724fea2a12f61fe710ab6cb1
- S: 50ce1ea59106b4c2c6bc502593a6a7a7dabf5041 127.0.0.1:7004
- slots: (0 slots) slave
- replicates 1f51443ede952b98724fea2a12f61fe710ab6cb1
- M: f9886c71e98a53270f7fda961e1c5f730382d48f 127.0.0.1:7003
- slots:12288-16383 (4096 slots) master
- 1 additional replica(s)
- S: 2ab1b061c36f30ae35604e9a171ae3afdc3c87e5 127.0.0.1:7008
- slots: (0 slots) slave
- replicates 1f51443ede952b98724fea2a12f61fe710ab6cb1
- S: 1f07d76585bfab35f91ec711ac53ab4bc00f2d3a 127.0.0.1:7002
- slots: (0 slots) slave
- replicates a5db243087d8bd423b9285fa8513eddee9bb59a6
- S: 8bb3ede48319b46d0015440a91ab277da9353c8b 127.0.0.1:7006
- slots: (0 slots) slave
- replicates f9886c71e98a53270f7fda961e1c5f730382d48f
- M: a5db243087d8bd423b9285fa8513eddee9bb59a6 127.0.0.1:7005
- slots:6827-10922 (4096 slots) master
- 1 additional replica(s)
- [OK] All nodes agree about slots configuration.
- >>> Check for open slots...
- >>> Check slots coverage...
- [OK] All 16384 slots covered.
- [root@localhost redis-cluster]#
可以看到7001已经连接不了;而7001的从节点7004自动分配到了7009主节点中,7009现在3个从节点。
2、移除从节点
比如删除7009的7008节点:
- [root@localhost redis-cluster]# ./redis-trib.rb del-node 127.0.0.1:7009 2ab1b061c36f30ae35604e9a171ae3afdc3c87e5
- >>> Removing node 2ab1b061c36f30ae35604e9a171ae3afdc3c87e5 from cluster 127.0.0.1:7009
- >>> Sending CLUSTER FORGET messages to the cluster...
- >>> SHUTDOWN the node.
- [root@localhost redis-cluster]# ./redis-trib.rb check 127.0.0.1:7008
- [ERR] Sorry, can't connect to node 127.0.0.1:7008
- [root@localhost redis-cluster]#
删除从节点比较方便,现在redis-cluster中有3个主节点,4个从节点,如下:
- [root@localhost redis-cluster]# ./redis-trib.rb check 127.0.0.1:7009
- >>> Performing Cluster Check (using node 127.0.0.1:7009)
- M: 1f51443ede952b98724fea2a12f61fe710ab6cb1 127.0.0.1:7009
- slots:0-6826,10923-12287 (8192 slots) master
- 2 additional replica(s)
- S: ee3efb90e5ac0725f15238a64fc60a18a71205d7 127.0.0.1:7007
- slots: (0 slots) slave
- replicates 1f51443ede952b98724fea2a12f61fe710ab6cb1
- S: 50ce1ea59106b4c2c6bc502593a6a7a7dabf5041 127.0.0.1:7004
- slots: (0 slots) slave
- replicates 1f51443ede952b98724fea2a12f61fe710ab6cb1
- M: f9886c71e98a53270f7fda961e1c5f730382d48f 127.0.0.1:7003
- slots:12288-16383 (4096 slots) master
- 1 additional replica(s)
- S: 1f07d76585bfab35f91ec711ac53ab4bc00f2d3a 127.0.0.1:7002
- slots: (0 slots) slave
- replicates a5db243087d8bd423b9285fa8513eddee9bb59a6
- S: 8bb3ede48319b46d0015440a91ab277da9353c8b 127.0.0.1:7006
- slots: (0 slots) slave
- replicates f9886c71e98a53270f7fda961e1c5f730382d48f
- M: a5db243087d8bd423b9285fa8513eddee9bb59a6 127.0.0.1:7005
- slots:6827-10922 (4096 slots) master
- 1 additional replica(s)
- [OK] All nodes agree about slots configuration.
- >>> Check for open slots...
- >>> Check slots coverage...
- [OK] All 16384 slots covered.
- [root@localhost redis-cluster]#
redis节点管理-节点的移除的更多相关文章
- redis节点管理-新增从节点
原文:http://blog.sina.com.cn/s/blog_53b45c4d0102wg12.html 新增从节点 新增一个节点7008节点,使用add-node --slave命令. [pl ...
- redis节点管理-新增主节点
原文:http://blog.sina.com.cn/s/blog_53b45c4d0102wg11.html 集群节点添加 节点新增包括新增主节点.从节点两种情况.以下分别做一下测试: 1.新增主节 ...
- docker swarm英文文档学习-7-在集群中管理节点
Manage nodes in a swarm在集群中管理节点 List nodes列举节点 为了查看集群中的节点列表,可以在管理节点中运行docker node ls: $ docker node ...
- Redis集群节点扩容及其 Redis 哈希槽
Redis 集群中内置了 16384 个哈希槽,当需要在 Redis 集群中放置一个 key-value 时,redis 先对 key 使用 crc16 算法算出一个结果,然后把结果对 16384 求 ...
- 在控制台启动服务器时出现:对于服务器soa1_wls, 与计算机oim1相关联的节点管理器无法访问。
问题:在控制台启动服务器时出现:对于服务器soa1_wls, 与计算机oim1相关联的节点管理器无法访问.原因:nodemanager没有启起来解决方法: 一.对于managedServer于admi ...
- [转] Jenkins实战演练之Windows系统节点管理
[前提] 通过<Jenkins实战演练之Windows服务器快速搭建>(http://my.oschina.net/iware/blog /191818)和<Jenkins实战演练之 ...
- [转]Jenkins使用 管理节点
现在我们已经搭建好了基本的Jenkins环境,在这一集里,我们说一说如何管理节点. 进入“系统管理”中的“管理节点”. 创建Windos系统的奴隶节点 先创建一台安装了Win7系统的虚拟机,作为Jen ...
- 转:对于服务器AdminServer, 与计算机Machine-0相关联的节点管理器无法访问
控制台启动server时报"对于服务器server-1与计算机machin<!--StartFragment -->对于服务器AdminServer, 与计算机Machine-0 ...
- 20151208_使用windows2012配置weblogic节点管理器
经过实践,weblogic节点管理器的作用主要有两点: 1.可通过weblogic控制台远程控制被管server启停. 2.可以自动重启被管server的进程,并且对spring框架提供比直接启动更快 ...
随机推荐
- linux加载指定目录的so文件
linux加载指定目录的so文件 http://blog.csdn.net/win_lin/article/details/8286125 download urlhttp://download.ch ...
- SqlServer存储过程中使用事务,示例
create proc pro_GetProTrans @GoodsId int, @Number int, @StockPrice money, @SupplierId int, @EmpId in ...
- HTML5API(4)
十三.服务器推送 服务器主动向客户端推送信息 传统的HTTP协议传输,服务器是被动相应客户端的请求 1.解决方案 ajax轮询.ajax长轮询 Server-Send-Event WebSocket ...
- IE8下面的line-height的bug
当line-height小于正常值时,超出的部分将被剪裁掉
- php设计模式四 ---- 原型模式
1.简介 用于创建重复的对象,同时又能保证性能.这种类型的设计模式属于创建型模式,它提供了一种创建对象的最佳方式 意图:用原型实例指定创建对象的种类,并且通过拷贝这些原型创建新的对象. 主要解决:在运 ...
- ajax登录请求,无法跳转
没有用form提交数据,用的ajax提交.服务器显示已经登录成功,并且返回了成功代码OK.却无法进行跳转: js代码: $("input[type='submit']").on(& ...
- P1466 集合 Subset Sums(01背包求填充方案数)
题目链接:https://www.luogu.org/problem/show?pid=1466 题目大意:对于从1到N (1 <= N <= 39) 的连续整数集合,能划分成两个子集合, ...
- Java容器类解析
1:集合 Collection(单列集合) List(有序,可重复) ArrayList 底层数据结构是数组,默认长度是十 查询快,增删慢 add()时判断是否数组越界,数组扩容为原来的1.5倍 线程 ...
- ffmpeg测试程序
ffmpeg在编译安装后在源码目录运行make fate可以编译并运行测试程序.如果提示找不到ffmpeg的库用LD_LIBRARY_PATH指定一下库安装的目录.
- HDU 1097.A hard puzzle-快速幂/取模
快速幂: 代码: ll pow_mod(ll a,ll b){ ll ans=; while(b){ ==){ ans=ans*a%mo ...