|NO.Z.00044|——————————|^^ 配置 ^^|——|Hadoop&Redis.V12|——|Redis.v12|集群扩容缩容.v02|

一、Redis集群扩容.从节点:扩容集群:扩容从节点
### --- 添加从节点
~~~     创建7008实例 (无数据)
     
[root@hadoop ~]# mkdir -p /opt/yanqi/servers/redis-cluster/7008
[root@hadoop ~]# cd /opt/yanqi/software/redis-5.0.5/src/
[root@hadoop src]#  make install PREFIX=/opt/yanqi/servers/redis-cluster/7008/

[root@hadoop src]# cp /opt/yanqi/servers/redis-cluster/7001/bin/redis.conf /opt/yanqi/servers/redis-cluster/7008/bin/
[root@hadoop src]# vim /opt/yanqi/servers/redis-cluster/7008/bin/redis.conf
 port 7008
### --- 添加7008结点作为新节点,并启动执行命令:
~~~     # 启动实例

[root@hadoop ~]#  cd /opt/yanqi/servers/redis-cluster/7008/bin/
[root@hadoop bin]# ./redis-server redis.conf
[root@hadoop bin]# ps -ef | grep redis
root      14647      1  0 22:05 ?        00:00:00 ./redis-server *:7008 [cluster]
二、扩容集群:添加从节点
### --- 添加7008从结点,将7008作为7007的从结点命令:

./redis-cli --cluster add-node 新节点的ip和端口 旧节点ip和端口 --cluster-slave --
cluster-master-id 主节点id
~~~     # 例如:
~~~     dc7283203025fc876c0e13d1c66456811f939338是7007结点的id,可通过cluster nodes查看。

./redis-cli --cluster add-node 192.168.1.111:7008 192.168.1.111:7007 \
--cluster-slave --cluster-master-id 563754061e341652654c8a4c2728162d518d1321
### --- 将从节点添加到集群中

[root@hadoop ~]# cd /opt/yanqi/servers/redis-cluster/7008/bin/
[root@hadoop bin]# ./redis-cli --cluster add-node 192.168.1.111:7008 192.168.1.111:7007 \
--cluster-slave --cluster-master-id 563754061e341652654c8a4c2728162d518d1321

>>> Adding node 192.168.1.111:7008 to cluster 192.168.1.111:7007
>>> Performing Cluster Check (using node 192.168.1.111:7007)
M: 563754061e341652654c8a4c2728162d518d1321 192.168.1.111:7007
   slots:[0-998],[5461-6461],[10923-11921] (2999 slots) master
S: 2e591b916b6fb7280341bbc6b7d4256bce56e066 192.168.1.111:7006
   slots: (0 slots) slave
   replicates d1831c06b14dcc935549734a65c9973f59dcb1b1
M: c2e99f75b566197ded715bdf12ff5607d5c793c9 192.168.1.111:7003
   slots:[11922-16383] (4462 slots) master
   1 additional replica(s)
M: 313fcb7e815bab87426f81d21176f58fde9d0fc7 192.168.1.111:7002
   slots:[6462-10922] (4461 slots) master
   1 additional replica(s)
S: 96033b241c0f1a328d95b59cb5b52fc043802958 192.168.1.111:7005
   slots: (0 slots) slave
   replicates c2e99f75b566197ded715bdf12ff5607d5c793c9
M: d1831c06b14dcc935549734a65c9973f59dcb1b1 192.168.1.111:7001
   slots:[999-5460] (4462 slots) master
   1 additional replica(s)
S: 16fa61286c999777ef0f56156750a7d18a8afd04 192.168.1.111:7004
   slots: (0 slots) slave
   replicates 313fcb7e815bab87426f81d21176f58fde9d0fc7
[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.1.111:7008 to make it join the cluster.
Waiting for the cluster to join

>>> Configure node as replica of 192.168.1.111:7007.
[OK] New node added correctly.
二、验证是否加入到集群中
### --- 查看实例是否添加仅集群中

127.0.0.1:7001> cluster nodes
563754061e341652654c8a4c2728162d518d1321 192.168.1.111:7007@17007 master - 0 1631997983000 7 connected 0-998 5461-6461 10923-11921
2e591b916b6fb7280341bbc6b7d4256bce56e066 192.168.1.111:7006@17006 slave d1831c06b14dcc935549734a65c9973f59dcb1b1 0 1631997984000 6 connected
96033b241c0f1a328d95b59cb5b52fc043802958 192.168.1.111:7005@17005 slave c2e99f75b566197ded715bdf12ff5607d5c793c9 0 1631997986000 5 connected
c2e99f75b566197ded715bdf12ff5607d5c793c9 192.168.1.111:7003@17003 master - 0 1631997986446 3 connected 11922-16383
6b0f8c1d1cf193b839785db883f2ff27b78f51cc 192.168.1.111:7008@17008 slave 563754061e341652654c8a4c2728162d518d1321 0 1631997983422 7 connected
16fa61286c999777ef0f56156750a7d18a8afd04 192.168.1.111:7004@17004 slave 313fcb7e815bab87426f81d21176f58fde9d0fc7 0 1631997985000 4 connected
d1831c06b14dcc935549734a65c9973f59dcb1b1 192.168.1.111:7001@17001 myself,master - 0 1631997983000 1 connected 999-5460
313fcb7e815bab87426f81d21176f58fde9d0fc7 192.168.1.111:7002@17002 master - 0 1631997984428 2 connected 6462-10922

 
 
 
 
 
 
 
 
 

Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart
                                                                                                                                                   ——W.S.Landor

 

 

posted on   yanqi_vip  阅读(13)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 【杭电多校比赛记录】2025“钉耙编程”中国大学生算法设计春季联赛(1)
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示