Redis Cluster 集群搭建及节点的添加、删除

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/zhengzhaoyang122/article/details/94321292

一、什么是 Redis Cluster


Redis 是在内存中保存数据的,而我们的电脑一般内存都不大,这也意味着 Reids 不适合存储大数据,适合存储大数据的是 Hadoop 生态系统的 Hbase 或者是 MogoDB 。Redis 更适合处理高并发,一台设备的存储能力是有限的但是多台设备协同合作,就可以内存增大很多倍,这时就需要集群。

Redis 集群搭建的方式有很多种,但从 redis 3.0 版本之后,支持 redis-cluster 集群,它是 Redis 官方提供的解决方案,Redis Cluster 采用的是 无中心架构每个节点保存数据和整个集群状态,每个节点都和其他节点有所连接。其架构如下:

客户端与 redis 节点直连,不需要中间件 proxy 层,客户端不需要连接集群所有节点,连接集群汇中任何一个节点即可。所有的 redis 节点彼此互联(PING-PONG 机制),内部使用二进制协议优化传输速度和带宽

二、分布式存储机制-槽


【1】、redis_cluster 把所有的节点映射到 [0-16383] slot 槽上,cluster 负责维护 node<->slot<->value 三者之间的关系。
【2】、Redis 集群中内置了 16384 个哈希槽,当需要在 Redis 集群中放置一个 key-value 时,redis 先将 key 使用 CRC16 算法算出一个结果,然后把结果对 16384 求余数,这样每个 key 都会对应一个编号 0-16383 之间的哈希槽,redis 会根据节点数量大致均等的将哈希槽映射到不同的节点上。

例如,当有三个节点时,槽分布的值如下:
节点1:     0-5460
节点2:     5461-10921
节点3:       10922-16383

 三、容错机制投票


【1】、选举过程是集群中所有 master 节点参与,如果半数以上 master 节点与故障节点通信超过设置的(cluster-node-timeout),认为该节点故障,自动触发故障转移操作。故障节点的从节点自动升级为主节点。
【2】、如果集群任意 master 挂掉,且当前 master 没有 slave。集群进入 fail 状态,也可以理解成集群的 slot 映射[0-16383]找不到对应的槽时进入 fail 状态。
 

四、搭建Redis-Cluster


准备工作:准备六台 Redis 服务器,三台 Master 主机,三台 Slave 备机(我们因条件问题,下面六台服务器均出自一台计算机,只是端口不一致(从7001-7006)

【1】、下载 Reids 的源码文件,进行解压(tar -zxvf redis-3.0.0.tar.gz),进入解码目录,对 C语言开发的 Redis 进行编译(make),编译完成后创建安装的目录(/usr/local/redis-cluster/redis-1 等),执行命令进行安装(make install PREFIX=/usr/local/redis-cluster/redis-1 等)
【2】、复制配置文件  将 /redis-3.0.0/redis.conf 复制到redis下的bin目录下(cp redis.conf /usr/local/redis-cluster/redis-1/bin
【3】、修改六台服务器中的 bin/redis.conf 配置文件,将配置集群字段前的注释去掉: # cluster-enabled yes 并修改端口(45行:port 7001
【4】、安装 Ruby 环境:

yum -y install ruby
yum -y install rubygems

【5】、网上下载 redis-3.0.0.gem,执行 gem install redis-3.0.0.gem 安装。
【6】、使用 ruby 脚本搭建集群:进入 Redis 源码目录中的 src 目录,执行如下命令:需要更换 IP 地址

./redis-trib.rb create --replicas 1 192.168.88.131:7001 192.168.88.131:7002 192.168.88.131:7003 192.168.88.131:7004 192.168.88.131:7005 192.168.88.131:7006

 出现如下情况时表示集群成功:如图所示,7001至7003为主机,7004至7006为备机。
 
然后输入 yes 输入如下信息时,则表示配置成功:成功后你会发现其他节点都会有变化。

五、客户端连接 RedisCluster


进入可以连接 Redis 的客户端文件中,例如:我在 Windows 环境下使用的是 redis-cli.exe 可执行文件。通过运行如下命令:进入 Redis 集群(-h:连接的主机地址、-p:连接的端口-c:表示集群环境不写表示连接的单机。Redis只需连接一个节点即可进入集群环境,可以通过 quit 命令退出 Redis 客户端连接。通过客户端关闭Redis服务:./redis-cli -h 地址 -p 端口 shutdown)。

六、通过 SpringDataRedis 连接 Redis 集群:主要是两个配置文件


 redis-cluster-config.properties(主要用于配置可变的服务器地址和端口

#cluster configuration
redis.host1=192.168.88.131
redis.port1=7001

redis.host2=192.168.88.131
redis.port2=7002

redis.host3=192.168.88.131
redis.port3=7003

redis.host4=192.168.88.131
redis.port4=7004

redis.host5=192.168.88.131
redis.port5=7005

redis.host6=192.168.88.131
redis.port6=7006

redis.maxRedirects=3
redis.maxIdle=100
redis.maxTotal=600

 applicationContext-redis-cluster.xml(从 properties 获取可变的参数作为属性传入集群类(redis-clusterConfiguration)中) 

<?xml version="1.0" encoding="UTF-8"?> 
<beans xmlns="http://www.springframework.org/schema/beans" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" 
  xmlns:context="http://www.springframework.org/schema/context" 
  xsi:schemaLocation="http://www.springframework.org/schema/beans   
            http://www.springframework.org/schema/beans/spring-beans.xsd   
            http://www.springframework.org/schema/context   
            http://www.springframework.org/schema/context/spring-context.xsd">  
	<!-- 加载配置属性文件 -->  
<context:property-placeholder ignore-unresolvable="true" location="classpath:properties/redis-cluster-config.properties" />  
<bean id="redis-clusterConfiguration" class="org.springframework.data.redis.connection.redis-clusterConfiguration">  
	<property name="maxRedirects" value="${redis.maxRedirects}"></property>  
	<property name="clusterNodes">  
	<set>  
	    <bean class="org.springframework.data.redis.connection.redis-clusterNode">  
	        <constructor-arg name="host" value="${redis.host1}"></constructor-arg>  
		<constructor-arg name="port" value="${redis.port1}"></constructor-arg>  
	    </bean>  
	    <bean class="org.springframework.data.redis.connection.redis-clusterNode">  
	        <constructor-arg name="host" value="${redis.host2}"></constructor-arg>  
		<constructor-arg name="port" value="${redis.port2}"></constructor-arg>  
	    </bean>  
	    <bean class="org.springframework.data.redis.connection.redis-clusterNode">  
		<constructor-arg name="host" value="${redis.host3}"></constructor-arg>  
		<constructor-arg name="port" value="${redis.port3}"></constructor-arg>  
	    </bean>  
	    <bean class="org.springframework.data.redis.connection.redis-clusterNode">  
	        <constructor-arg name="host" value="${redis.host4}"></constructor-arg>  
	        <constructor-arg name="port" value="${redis.port4}"></constructor-arg>  
	     </bean>  
	     <bean class="org.springframework.data.redis.connection.redis-clusterNode">  
	        <constructor-arg name="host" value="${redis.host5}"></constructor-arg>  
	        <constructor-arg name="port" value="${redis.port5}"></constructor-arg>  
	     </bean>  
	     <bean class="org.springframework.data.redis.connection.redis-clusterNode">  
	        <constructor-arg name="host" value="${redis.host6}"></constructor-arg>  
		<constructor-arg name="port" value="${redis.port6}"></constructor-arg>  
	     </bean>  
	 </set>  
	 </property>  
</bean>  
<bean id="jedisPoolConfig"   class="redis.clients.jedis.JedisPoolConfig">  
        <property name="maxIdle" value="${redis.maxIdle}" />   
	<property name="maxTotal" value="${redis.maxTotal}" />   
</bean>  
<bean id="jeidsConnectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory"  >  
        <constructor-arg ref="redis-clusterConfiguration" />  
        <constructor-arg ref="jedisPoolConfig" />  
</bean>    
<bean id="redisTemplate" class="org.springframework.data.redis.core.RedisTemplate">  
        <property name="connectionFactory" ref="jeidsConnectionFactory" />  
</bean>  
</beans>

七、查询集群状态信息


  通过 cluster info 查询集群状态信息

192.168.88.131:7001> cluster info
cluster_state:ok                        #集群状态
cluster_slots_assigned:16384            #被分配的槽位数
cluster_slots_ok:16384                  #正确分配的槽位数
cluster_slots_pfail:0
cluster_slots_fail:0
cluster_known_nodes:6                   #集群的节点个数
cluster_size:3
cluster_current_epoch:9
cluster_my_epoch:1
cluster_stats_messages_sent:9769
cluster_stats_messages_received:9740

八、 添加主节点


【1】、集群创建成功后,向集群创建添加 master 节点,准备一个 Redis 节点(7007 端口)并修改配置文件,随后将其启动成功,再新打开一个窗口,进入存放 redis-trib.rb 文件的目录下:执行如下命令:

[root@learnVM redis-cluster]# ./redis-trib.rb add-node 192.168.88.131:7007 192.168.88.131:7001
>>> Adding node 192.168.88.131:7007 to cluster 192.168.88.131:7001
Connecting to node 192.168.88.131:7001: OK
Connecting to node 192.168.88.131:7002: OK
Connecting to node 192.168.88.131:7005: OK
Connecting to node 192.168.88.131:7006: OK
Connecting to node 192.168.88.131:7004: OK
Connecting to node 192.168.88.131:7003: OK
>>> Performing Cluster Check (using node 192.168.88.131:7001)
M: bd2b45a9395aafd3104291b4fb57a53cc12238db 192.168.88.131:7001
   slots:0-5460 (5461 slots) master
   1 additional replica(s)
S: 2483a4a01a6cdbce33dfd58d08463cfe3651dbb4 192.168.88.131:7002
   slots: (0 slots) slave
   replicates 3628651a416fa8e8b8b82eff2608173ca75937a5
M: 3628651a416fa8e8b8b82eff2608173ca75937a5 192.168.88.131:7005
   slots:5461-10922 (5462 slots) master
   1 additional replica(s)
S: 5f3f7324507788d072f4c9e13b428cfac5bcfaef 192.168.88.131:7006
   slots: (0 slots) slave
   replicates 11e83e152aaa229325db94c4bbb7c846872a94cc
S: a0d5b3f18bbb0cb37c0bf92aaca97ac8ba980d10 192.168.88.131:7004
   slots: (0 slots) slave
   replicates bd2b45a9395aafd3104291b4fb57a53cc12238db
M: 11e83e152aaa229325db94c4bbb7c846872a94cc 192.168.88.131:7003
   slots:10923-16383 (5461 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.
Connecting to node 192.168.88.131:7007: OK
>>> Send CLUSTER MEET to node 192.168.88.131:7007 to make it join the cluster.
[OK] New node added correctly.

【2】、在客户端执行:cluster nodes 查看集群节点:会发现新添加的集群节点 7007(作为master却没有槽数<最后面的x-x>)

192.168.88.131:7001> cluster nodes
bd2b45a9395aafd3104291b4fb57a53cc12238db 192.168.88.131:7001 myself,master - 0 0 1 connected 0-5460
f4451c0e7d525303897e202cb504f7880b64e4fd 192.168.88.131:7007 master - 0 1562167495488 0 connected
2483a4a01a6cdbce33dfd58d08463cfe3651dbb4 192.168.88.131:7002 slave 3628651a416fa8e8b8b82eff2608173ca75937a5 0 1562167497511 10 connected
3628651a416fa8e8b8b82eff2608173ca75937a5 192.168.88.131:7005 master - 0 1562167497007 10 connected 5461-10922
5f3f7324507788d072f4c9e13b428cfac5bcfaef 192.168.88.131:7006 slave 11e83e152aaa229325db94c4bbb7c846872a94cc 0 1562167496501 8 connected
a0d5b3f18bbb0cb37c0bf92aaca97ac8ba980d10 192.168.88.131:7004 slave bd2b45a9395aafd3104291b4fb57a53cc12238db 0 1562167493969 4 connected
11e83e152aaa229325db94c4bbb7c846872a94cc 192.168.88.131:7003 master - 0 1562167494477 8 connected 10923-16383

 【3】、hash 槽从新分配:添加完主节点需要对主节点进行hash槽分配这样该主节才可以存储数据redis 集群有16384个槽,集群中的每个 master 结点分配一些槽,通过查看集群结点可以看到槽占用情况。开始分配:执行如下命令

[root@learnVM redis-cluster]# ./redis-trib.rb reshard 192.168.88.131:7001
Connecting to node 192.168.88.131:7001: OK
Connecting to node 192.168.88.131:7007: OK
Connecting to node 192.168.88.131:7002: OK
Connecting to node 192.168.88.131:7005: OK
Connecting to node 192.168.88.131:7006: OK
Connecting to node 192.168.88.131:7004: OK
Connecting to node 192.168.88.131:7003: OK
>>> Performing Cluster Check (using node 192.168.88.131:7001)
M: bd2b45a9395aafd3104291b4fb57a53cc12238db 192.168.88.131:7001
   slots:0-5460 (5461 slots) master
   1 additional replica(s)
M: f4451c0e7d525303897e202cb504f7880b64e4fd 192.168.88.131:7007
   slots: (0 slots) master
   0 additional replica(s)
S: 2483a4a01a6cdbce33dfd58d08463cfe3651dbb4 192.168.88.131:7002
   slots: (0 slots) slave
   replicates 3628651a416fa8e8b8b82eff2608173ca75937a5
M: 3628651a416fa8e8b8b82eff2608173ca75937a5 192.168.88.131:7005
   slots:5461-10922 (5462 slots) master
   1 additional replica(s)
S: 5f3f7324507788d072f4c9e13b428cfac5bcfaef 192.168.88.131:7006
   slots: (0 slots) slave
   replicates 11e83e152aaa229325db94c4bbb7c846872a94cc
S: a0d5b3f18bbb0cb37c0bf92aaca97ac8ba980d10 192.168.88.131:7004
   slots: (0 slots) slave
   replicates bd2b45a9395aafd3104291b4fb57a53cc12238db
M: 11e83e152aaa229325db94c4bbb7c846872a94cc 192.168.88.131:7003
   slots:10923-16383 (5461 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.
How many slots do you want to move (from 1 to 16384)? 

 ☛  出现上述的:How many slots do you want to move(是询问你需要分配的槽大小:我们就输入1000<输入1000表示要分配1000个槽>)

What is the receiving node ID? f4451c0e7d525303897e202cb504f7880b64e4fd

 ☛  出现上述情况:询问需要分配槽的节点id:我们就输入7007的节点ID(就是刚才执行 cluster nodes 返回的第一行数据)

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:

 ☛  输入源节点 id:槽将从源节点中拿,分配后的槽在源节点就不存在了。输入 all 将从所有源节点开始拿,done 取消分配。

......
    Moving slot 11254 from 11e83e152aaa229325db94c4bbb7c846872a94cc
    Moving slot 11255 from 11e83e152aaa229325db94c4bbb7c846872a94cc
Do you want to proceed with the proposed reshard plan (yes/no)? yes

 ☛  输入 yes 开始移动槽到目标结点 id

Moving slot 11253 from 192.168.88.131:7003 to 192.168.88.131:7007: 
Moving slot 11254 from 192.168.88.131:7003 to 192.168.88.131:7007: 
Moving slot 11255 from 192.168.88.131:7003 to 192.168.88.131:7007: 
[root@learnVM redis-cluster]# 

【4】、重新查看节点信息: 7007的槽(0-332 5461-5794 10923-11255)是来自其他三个master节点的部分槽。

192.168.88.131:7001> cluster nodes
bd2b45a9395aafd3104291b4fb57a53cc12238db 192.168.88.131:7001 myself,master - 0 0 1 connected 333-5460
f4451c0e7d525303897e202cb504f7880b64e4fd 192.168.88.131:7007 master - 0 1562169453293 11 connected 0-332 5461-5794 10923-11255
2483a4a01a6cdbce33dfd58d08463cfe3651dbb4 192.168.88.131:7002 slave 3628651a416fa8e8b8b82eff2608173ca75937a5 0 1562169456321 10 connected
3628651a416fa8e8b8b82eff2608173ca75937a5 192.168.88.131:7005 master - 0 1562169450269 10 connected 5795-10922
5f3f7324507788d072f4c9e13b428cfac5bcfaef 192.168.88.131:7006 slave 11e83e152aaa229325db94c4bbb7c846872a94cc 0 1562169449259 8 connected
a0d5b3f18bbb0cb37c0bf92aaca97ac8ba980d10 192.168.88.131:7004 slave bd2b45a9395aafd3104291b4fb57a53cc12238db 0 1562169454300 4 connected
11e83e152aaa229325db94c4bbb7c846872a94cc 192.168.88.131:7003 master - 0 1562169455309 8 connected 11256-16383

九、添加从节点


集群创建成功后,可以向集群中插入一个 slave 从节点(准备一个 7008 端口的 Redis并将其启动成功,我们将其配置为 7007 的从节点),打开新的窗口,进入存放 redis-trib.rb 文件的目录下,执行如下命令(格式为:./redis-trib.rb add-node --slave --master-id 主节点id 添加节点的ip和端口 集群中已存在节点ip和端口):其中主节点ID,通过 cluster nodes 查询获取

[root@learnVM redis-cluster]# ./redis-trib.rb add-node --slave --master-id f4451c0e7d525303897e202cb504f7880b64e4fd 192.168.88.131:7008 192.168.88.131:7001
>>> Adding node 192.168.88.131:7008 to cluster 192.168.88.131:7001
Connecting to node 192.168.88.131:7001: OK
Connecting to node 192.168.88.131:7007: OK
Connecting to node 192.168.88.131:7002: OK
Connecting to node 192.168.88.131:7005: OK
Connecting to node 192.168.88.131:7006: OK
Connecting to node 192.168.88.131:7004: OK
Connecting to node 192.168.88.131:7003: OK
>>> Performing Cluster Check (using node 192.168.88.131:7001)
M: bd2b45a9395aafd3104291b4fb57a53cc12238db 192.168.88.131:7001
   slots:333-5460 (5128 slots) master
   1 additional replica(s)
M: f4451c0e7d525303897e202cb504f7880b64e4fd 192.168.88.131:7007
   slots:0-332,5461-5794,10923-11255 (1000 slots) master
   0 additional replica(s)
M: 2483a4a01a6cdbce33dfd58d08463cfe3651dbb4 192.168.88.131:7002
   slots:5795-10922 (5128 slots) master
   1 additional replica(s)
S: 3628651a416fa8e8b8b82eff2608173ca75937a5 192.168.88.131:7005
   slots: (0 slots) slave
   replicates 2483a4a01a6cdbce33dfd58d08463cfe3651dbb4
S: 5f3f7324507788d072f4c9e13b428cfac5bcfaef 192.168.88.131:7006
   slots: (0 slots) slave
   replicates 11e83e152aaa229325db94c4bbb7c846872a94cc
S: a0d5b3f18bbb0cb37c0bf92aaca97ac8ba980d10 192.168.88.131:7004
   slots: (0 slots) slave
   replicates bd2b45a9395aafd3104291b4fb57a53cc12238db
M: 11e83e152aaa229325db94c4bbb7c846872a94cc 192.168.88.131:7003
   slots:11256-16383 (5128 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.
Connecting to node 192.168.88.131:7008: OK
>>> Send CLUSTER MEET to node 192.168.88.131:7008 to make it join the cluster.
Waiting for the cluster to join.
>>> Configure node as replica of 192.168.88.131:7007.
[OK] New node added correctly.

 通过客户端程序查看集群节点信息:cluster nodes 得知 70087007 slave 节点

192.168.88.131:7001> cluster nodes
bd2b45a9395aafd3104291b4fb57a53cc12238db 192.168.88.131:7001 myself,master - 0 0 1 connected 333-5460
9d4b0154bad39acd862d651f0be5d3606e862862 192.168.88.131:7008 slave f4451c0e7d525303897e202cb504f7880b64e4fd 0 1562244812807 11 connected
f4451c0e7d525303897e202cb504f7880b64e4fd 192.168.88.131:7007 master - 0 1562244810282 11 connected 0-332 5461-5794 10923-11255
2483a4a01a6cdbce33dfd58d08463cfe3651dbb4 192.168.88.131:7002 master - 0 1562244813825 12 connected 5795-10922
3628651a416fa8e8b8b82eff2608173ca75937a5 192.168.88.131:7005 slave 2483a4a01a6cdbce33dfd58d08463cfe3651dbb4 0 1562244809775 12 connected
5f3f7324507788d072f4c9e13b428cfac5bcfaef 192.168.88.131:7006 slave 11e83e152aaa229325db94c4bbb7c846872a94cc 0 1562244808764 8 connected
a0d5b3f18bbb0cb37c0bf92aaca97ac8ba980d10 192.168.88.131:7004 slave bd2b45a9395aafd3104291b4fb57a53cc12238db 0 1562244810786 4 connected
11e83e152aaa229325db94c4bbb7c846872a94cc 192.168.88.131:7003 master - 0 1562244811799 8 connected 11256-16383

十、删除节点


【1】、我们将刚添加的 7008 从节点进行删除,命令如下:删除后通过 cluster nodes 查看发现 7008 成功移除

[root@learnVM redis-cluster]# ./redis-trib.rb del-node 192.168.88.131:7008 9d4b0154bad39acd862d651f0be5d3606e862862
>>> Removing node 9d4b0154bad39acd862d651f0be5d3606e862862 from cluster 192.168.88.131:7008
Connecting to node 192.168.88.131:7008: OK
Connecting to node 192.168.88.131:7004: OK
Connecting to node 192.168.88.131:7003: OK
Connecting to node 192.168.88.131:7002: OK
Connecting to node 192.168.88.131:7005: OK
Connecting to node 192.168.88.131:7001: OK
Connecting to node 192.168.88.131:7006: OK
Connecting to node 192.168.88.131:7007: OK
>>> Sending CLUSTER FORGET messages to the cluster...
>>> SHUTDOWN the node.

【2】、接着主节点 7007 会发现不能删除,因为其占有 hash 槽,需要将槽分配给其他节点,方能删除:

[root@learnVM redis-cluster]# ./redis-trib.rb del-node 192.168.88.131:7007 f4451c0e7d525303897e202cb504f7880b64e4fd
>>> Removing node f4451c0e7d525303897e202cb504f7880b64e4fd from cluster 192.168.88.131:7007
Connecting to node 192.168.88.131:7007: OK
Connecting to node 192.168.88.131:7006: OK
Connecting to node 192.168.88.131:7002: OK
Connecting to node 192.168.88.131:7003: OK
Connecting to node 192.168.88.131:7005: OK
Connecting to node 192.168.88.131:7001: OK
Connecting to node 192.168.88.131:7004: OK
[ERR] Node 192.168.88.131:7007 is not empty! Reshard data away and try again.

【3】、将 7007 的槽分配给 7001(参考 八【3】 的槽重新分配:重点修改内容如下:) 

(ps:通过任意节点连接上集群redis集群)
[root@learnVM redis-cluster]# ./redis-trib.rb reshard 192.168.88.131:7001
(ps:输入当时分配给7007的槽个数1000)
How many slots do you want to move (from 1 to 16384)? 1000
(ps:输入要分给的节点ID,这里我输的是7001的ID)
What is the receiving node ID? bd2b45a9395aafd3104291b4fb57a53cc12238db
(ps:这里输入槽的来源:输入7007的ID,之前输入的是all)
Source node #1:f4451c0e7d525303897e202cb504f7880b64e4fd
(ps:输入done表示可以开始迁移计划)
Source node #2:done
(ps:输入yes表示可以开始执行迁移计划)
Do you want to proceed with the proposed reshard plan (yes/no)? yes
(ps:可以通过 cluster nodes 查看7007的槽个数了)

【4】、重新执行删除 7007 节点的命令:通过 cluster nodes 会发现 7007 节点以被删除

[root@learnVM redis-cluster]# ./redis-trib.rb del-node 192.168.88.131:7007 f4451c0e7d525303897e202cb504f7880b64e4fd
>>> Removing node f4451c0e7d525303897e202cb504f7880b64e4fd from cluster 192.168.88.131:7007
Connecting to node 192.168.88.131:7007: OK
Connecting to node 192.168.88.131:7006: OK
Connecting to node 192.168.88.131:7002: OK
Connecting to node 192.168.88.131:7003: OK
Connecting to node 192.168.88.131:7005: OK
Connecting to node 192.168.88.131:7001: OK
Connecting to node 192.168.88.131:7004: OK
>>> Sending CLUSTER FORGET messages to the cluster...
>>> SHUTDOWN the node.

------如果喜欢,点个红心支持以下,谢谢-----

展开阅读全文

没有更多推荐了,返回首页