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框架提供比直接启动更快 ...
随机推荐
- RadioButton 带下划线切换的案例
xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout android:id=& ...
- 虚拟存储管理中几种缺页中断算法(最佳置换法OPT)
缺页中断就是要访问的页不在主存,需要操作系统将其调入主存后再进行访问. 在进行内存访问时,若所访问的页已在主存,则称此次访问成功: 若所访问的页不在主存,则称此次访问失败,并产生缺页中断. 最佳置换法 ...
- Can't load standard profile: GRAY.pf
报错: java.lang.IllegalArgumentException: Can't load standard profile: GRAY.pf at java.awt.color.ICC_P ...
- datatables的学习总结
$(document).ready(function() { var oTable= $('#dataTables-example').DataTable({ // searching : false ...
- linux命令(3):rpm命令
查询当前环境是否已安装软件包,如下命令: [root@cloud ~]# rpm -qa | grep httpd httpd-2.4.6-31.el7.centos.1.x86_64 httpd-t ...
- Razor 部分页面
最近在和师父一起打野,后台要求挺多的.后台还是用的EF和MVC5,页面使用的razor. 现在是发现好多的页面有太多重复的东西了. 比如说查询页面的字段,比如说列表页,比如说详情方法都有. 灵机一动, ...
- css div图片上下左右居中
<style type="text/css"> div{border:1px solid #ccc;height:500pc;width:500px;text-alig ...
- vue中keep-alive
vue2.0提供了一个keep-alive组件用来缓存组件,避免多次加载相应的组件,减少性能消耗 1.基本用法,缓存整个页面或组件 <keep-alive> <component&g ...
- struts2核心配置之Result
result作用:在struts.xml中,使用<result>元素配置result逻辑视图和物理视图之间的映射 元素属性 属性 说明 是否必须 name 指定逻辑视图的名称(Action ...
- jdbc 回顾
JDBC实现基本的CRUD示例 private static void insertTest() throws SQLException { String dbURL = "jdbc:mys ...