34_创建Redis集群 管理集群

版本:4.0.8

环境准备 准备 6台(51-56) redis服务器  以默认配置运行redis服务即可
一.创建Redis集群
1.启用集群功能( 51-56 都要配置)
]# netstat -antupl |grep :6379(要有东西)
]# /etc/init.d/redis_6379 stop
 
*一一对应,以52为例*
]# vim /etc/redis/6379.conf
70 bind 192.168.4.52
93 port 6352
815 cluster-enabled yes
823 cluster-config-file nodes-6352.conf
829 cluster-node-timeout 5000
:wq
 
]# /etc/init.d/redis_6379 start
 
]# netstat -utnlp  | grep redis-server
tcp  0  0 192.168.4.52:6352  0.0.0.0:* LISTEN      7469/redis-server 1
tcp  0  0 192.168.4.52:16352 0.0.0.0:* LISTEN      7469/redis-server 1
 
]# cat /var/lib/redis/6379/nodes-6352.conf  查看集群信息文件
47b98f4c7d16486e5f8032e7a420675a025dd090 :[email protected] myself,master - 0 0 0 connected
vars currentEpoch 0 lastVoteEpoch 0
 
2 创建集群
2.1 部署ruby脚本执行环境 (192.168.4.51)  
]# yum -y install ruby rubygems uby-devel
]# gem install redis-3.2.1.gem
]# gem install redis-3.2.1.gem
Successfully installed redis-3.2.1
Parsing documentation for redis-3.2.1
Installing ri documentation for redis-3.2.1
1 gem installed
 
2.2 创建管理集群的ruby脚本
]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
]# mkdir /root/bin
]# cp redis-4.0.8/src/redis-trib.rb /root/bin/
]# chmod +x /root/bin/redis-trib.rb
]# redis-trib.rb help
Usage: redis-trib <command> <options> <arguments ...>

create          host1:port1 ... hostN:portN
                  --replicas <arg>
  check           host:port
  info            host:port
  fix             host:port
                  --timeout <arg>
  reshard         host:port
                  --from <arg>
                  --to <arg>
                  --slots <arg>
                  --yes
                  --timeout <arg>
                  --pipeline <arg>
  rebalance       host:port
                  --weight <arg>
                  --auto-weights
                  --use-empty-masters
                  --timeout <arg>
                  --simulate
                  --pipeline <arg>
                  --threshold <arg>
  add-node        new_host:new_port existing_host:existing_port
                  --slave
                  --master-id <arg>
  del-node        host:port node_id
  set-timeout     host:port milliseconds
  call            host:port command arg arg .. arg
  import          host:port
                  --from <arg>
                  --copy
                  --replace
  help            (show this help)
 
2.3 创建集群
]# redis-trib.rb create --replicas 1 \
> 192.168.4.51:6351  192.168.4.52:6352 \
> 192.168.4.53:6353  192.168.4.54:6354 \
> 192.168.4.55:6355  192.168.4.56:6356
...
Can I set the above configuration? (type ‘yes‘ to accept): yes(输入yes)
...
[OK] All 16384 slots covered.
 
3 查看集群中主机状态信息
]# cat /var/lib/redis/6379/nodes-6351.conf
]# redis-cli -h 192.168.4.51 -p 6351
> 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:6
cluster_my_epoch:1
cluster_stats_messages_ping_sent:189
cluster_stats_messages_pong_sent:175
cluster_stats_messages_sent:364
cluster_stats_messages_ping_received:170
cluster_stats_messages_pong_received:189
cluster_stats_messages_meet_received:5
cluster_stats_messages_received:364

> cluster nodes
47b98f4c7d16486e5f8032e7a420675a025dd090 192.168.4.52:[email protected] master - 0 1580813019504 2 connected 5461-10922
3680239417226f1e0cc1b744e822de5c85b84890 192.168.4.53:[email protected] master - 0 1580813018602 3 connected 10923-16383
e528e231af6cb62ade68202e9fee2b5b090c9025 192.168.4.55:[email protected] slave d9e8b7d81f4dff3d3157747e92b521220774da8b 0 1580813019104 5 connected
2384a45084fec6db31e3331912c92379c45bd4bd 192.168.4.56:[email protected] slave 47b98f4c7d16486e5f8032e7a420675a025dd090 0 1580813019605 6 connected
43eb87ced708e2845e5b58618c817e2e1535e882 192.168.4.54:[email protected] slave 3680239417226f1e0cc1b744e822de5c85b84890 0 1580813019104 4 connected
d9e8b7d81f4dff3d3157747e92b521220774da8b 192.168.4.51:[email protected] myself,master - 0 1580813018000 1 connected 0-5460

集群创建失败的解决办法
]# redis-cli -h x.x.x.x -p xxxx shutdown
]# rm -rf /var/lib/redis/6379/*
]# /etc/init.d/redis_6379 start
]# netstat -utnlp  | grep redis_server
再次执行创建集群命令
 
4 测试集群 在192.168.4.50 访问集群存取数据(可以连接任意一台主库的ip地址)
]# redis-cli -c -h 192.168.4.51 -p 6351
192.168.4.51:6351> keys *
(empty list or set)

192.168.4.51:6351> set x 101
-> Redirected to slot [16287] located at 192.168.4.53:6353
OK

192.168.4.53:6353> keys * (现在自动切换到6353库)
1) "x"
 
主库对应的从库,会自动把数据同步到本机。
在管理主机51上 执行如下操作
]# redis-trib.rb info 192.168.4.51:6351  查看数据存储情况
192.168.4.51:6351 (d9e8b7d8...) -> 0 keys | 5461 slots | 1 slaves.
192.168.4.52:6352 (47b98f4c...) -> 0 keys | 5462 slots | 1 slaves.
192.168.4.53:6353 (36802394...) -> 1 keys | 5461 slots | 1 slaves.
[OK] 1 keys in 3 masters.
0.00 keys per slot on average.
 
]# redis-trib.rb check 192.168.4.51:6351 查看集群信息
>>> Performing Cluster Check (using node 192.168.4.51:6351)
M: d9e8b7d81f4dff3d3157747e92b521220774da8b 192.168.4.51:6351
   slots:0-5460 (5461 slots) master
   1 additional replica(s)
M: 47b98f4c7d16486e5f8032e7a420675a025dd090 192.168.4.52:6352
   slots:5461-10922 (5462 slots) master
   1 additional replica(s)
M: 3680239417226f1e0cc1b744e822de5c85b84890 192.168.4.53:6353
   slots:10923-16383 (5461 slots) master
   1 additional replica(s)
S: e528e231af6cb62ade68202e9fee2b5b090c9025 192.168.4.55:6355
   slots: (0 slots) slave
   replicates d9e8b7d81f4dff3d3157747e92b521220774da8b
S: 2384a45084fec6db31e3331912c92379c45bd4bd 192.168.4.56:6356
   slots: (0 slots) slave
   replicates 47b98f4c7d16486e5f8032e7a420675a025dd090
S: 43eb87ced708e2845e5b58618c817e2e1535e882 192.168.4.54:6354
   slots: (0 slots) slave
   replicates 3680239417226f1e0cc1b744e822de5c85b84890
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.

主库  从库
51 -- 55
52 -- 56
53 -- 54
 
主库 宕机后,对应的从库会自动升级为主库(52宕机,56主库)
]# redis-cli -h 192.168.4.52 -p 6352 shutdown
]# redis-trib.rb check 192.168.4.51:6351
>>> Performing Cluster Check (using node 192.168.4.51:6351)
M: d9e8b7d81f4dff3d3157747e92b521220774da8b 192.168.4.51:6351
   slots:0-5460 (5461 slots) master
   1 additional replica(s)
M: 3680239417226f1e0cc1b744e822de5c85b84890 192.168.4.53:6353
   slots:10923-16383 (5461 slots) master
   1 additional replica(s)
S: e528e231af6cb62ade68202e9fee2b5b090c9025 192.168.4.55:6355
   slots: (0 slots) slave
   replicates d9e8b7d81f4dff3d3157747e92b521220774da8b
M: 2384a45084fec6db31e3331912c92379c45bd4bd 192.168.4.56:6356
   slots:5461-10922 (5462 slots) master
   0 additional replica(s)
S: 43eb87ced708e2845e5b58618c817e2e1535e882 192.168.4.54:6354
   slots: (0 slots) slave
   replicates 3680239417226f1e0cc1b744e822de5c85b84890
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.
 
开启52,变为56的从库
mysql52]# /etc/init.d/redis_6379 start
]# redis-trib.rb check 192.168.4.51:6351
>>> Performing Cluster Check (using node 192.168.4.51:6351)
M: d9e8b7d81f4dff3d3157747e92b521220774da8b 192.168.4.51:6351
   slots:0-5460 (5461 slots) master
   1 additional replica(s)
S: 47b98f4c7d16486e5f8032e7a420675a025dd090 192.168.4.52:6352
   slots: (0 slots) slave
   replicates 2384a45084fec6db31e3331912c92379c45bd4bd
M: 3680239417226f1e0cc1b744e822de5c85b84890 192.168.4.53:6353
   slots:10923-16383 (5461 slots) master
   1 additional replica(s)
S: e528e231af6cb62ade68202e9fee2b5b090c9025 192.168.4.55:6355
   slots: (0 slots) slave
   replicates d9e8b7d81f4dff3d3157747e92b521220774da8b
M: 2384a45084fec6db31e3331912c92379c45bd4bd 192.168.4.56:6356
   slots:5461-10922 (5462 slots) master
   1 additional replica(s)
S: 43eb87ced708e2845e5b58618c817e2e1535e882 192.168.4.54:6354
   slots: (0 slots) slave
   replicates 3680239417226f1e0cc1b744e822de5c85b84890
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.

二.管理集群
 
准备2台新的虚拟机ip 地址分别为 192.168.4.57  192.168.4.58
运行redis服务并启用的集群配置
 
]# /etc/init.d/redis_6379 stop
]# vim /etc/redis/6379.conf(52为例子)
70 bind 192.168.4.52
93 port 6352
815 cluster-enabled yes
823 cluster-config-file nodes-6352.conf
829 cluster-node-timeout 5000
:wq
]# /etc/init.d/redis_6379 start
]# netstat -utnlp  | grep redis-server
 
2.1 向集群里添加新主机
 
2.1.1 添加master角色主机  (添加 192.168.4.57,在51操作)
]# redis-trib.rb add-node 192.168.4.57:6357 192.168.4.51:6351
]# redis-trib.rb check 192.168.4.51:6351 查看
>>> Performing Cluster Check (using node 192.168.4.51:6351)
M: d9e8b7d81f4dff3d3157747e92b521220774da8b 192.168.4.51:6351
   slots:0-5460 (5461 slots) master
   1 additional replica(s)
S: 47b98f4c7d16486e5f8032e7a420675a025dd090 192.168.4.52:6352
   slots: (0 slots) slave
   replicates 2384a45084fec6db31e3331912c92379c45bd4bd
M: 3680239417226f1e0cc1b744e822de5c85b84890 192.168.4.53:6353
   slots:10923-16383 (5461 slots) master
   1 additional replica(s)
S: e528e231af6cb62ade68202e9fee2b5b090c9025 192.168.4.55:6355
   slots: (0 slots) slave
   replicates d9e8b7d81f4dff3d3157747e92b521220774da8b
M: 2384a45084fec6db31e3331912c92379c45bd4bd 192.168.4.56:6356
   slots:5461-10922 (5462 slots) master
   1 additional replica(s)
M: 44077cd747b4b32b9026a8f8ae2c0a1a4cca7441 192.168.4.57:6357
   slots: (0 slots) master
   0 additional replica(s)
S: 43eb87ced708e2845e5b58618c817e2e1535e882 192.168.4.54:6354
   slots: (0 slots) slave
   replicates 3680239417226f1e0cc1b744e822de5c85b84890
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.

]# redis-trib.rb reshard 192.168.4.51:6351 重新分片
指定移出hash槽个数    4096
指定接收hash槽主机ID 57主机的ID值 440...
指定移出hash槽主机ID all
同意这样分片 yes
 
查看分片
]# redis-trib.rb check 192.168.4.51:6351
>>> Performing Cluster Check (using node 192.168.4.51:6351)
M: d9e8b7d81f4dff3d3157747e92b521220774da8b 192.168.4.51:6351
   slots:1365-5460 (4096 slots) master
   1 additional replica(s)
S: 47b98f4c7d16486e5f8032e7a420675a025dd090 192.168.4.52:6352
   slots: (0 slots) slave
   replicates 2384a45084fec6db31e3331912c92379c45bd4bd
M: 3680239417226f1e0cc1b744e822de5c85b84890 192.168.4.53:6353
   slots:12288-16383 (4096 slots) master
   1 additional replica(s)
S: e528e231af6cb62ade68202e9fee2b5b090c9025 192.168.4.55:6355
   slots: (0 slots) slave
   replicates d9e8b7d81f4dff3d3157747e92b521220774da8b
M: 2384a45084fec6db31e3331912c92379c45bd4bd 192.168.4.56:6356
   slots:6827-10922 (4096 slots) master
   1 additional replica(s)
M: 44077cd747b4b32b9026a8f8ae2c0a1a4cca7441 192.168.4.57:6357
   slots:0-1364,5461-6826,10923-12287 (4096 slots) master
   0 additional replica(s)
S: 43eb87ced708e2845e5b58618c817e2e1535e882 192.168.4.54:6354
   slots: (0 slots) slave
   replicates 3680239417226f1e0cc1b744e822de5c85b84890
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.
 
客户端连接主库57 可以存取数据
]# redis-cli -c -h 192.168.4.57 -p 6357
192.168.4.57:6357> ping
PONG
192.168.4.57:6357> set key 111
-> Redirected to slot [12539] located at 192.168.4.53:6353
OK
192.168.4.53:6353> get key
"111"
192.168.4.53:6353> keys *
1) "key"
2) "x"
 
2.1.2 添加slave角色主机 (添加slave 192.168.4.58 51上操作)
]# redis-trib.rb add-node --slave 192.168.4.58:6358 192.168.4.51:6351
]# redis-trib.rb check 192.168.4.51:6351
>>> Performing Cluster Check (using node 192.168.4.51:6351)
M: d9e8b7d81f4dff3d3157747e92b521220774da8b 192.168.4.51:6351
   slots:1365-5460 (4096 slots) master
   1 additional replica(s)
S: 47b98f4c7d16486e5f8032e7a420675a025dd090 192.168.4.52:6352
   slots: (0 slots) slave
   replicates 2384a45084fec6db31e3331912c92379c45bd4bd
M: 3680239417226f1e0cc1b744e822de5c85b84890 192.168.4.53:6353
   slots:12288-16383 (4096 slots) master
   1 additional replica(s)
S: e528e231af6cb62ade68202e9fee2b5b090c9025 192.168.4.55:6355
   slots: (0 slots) slave
   replicates d9e8b7d81f4dff3d3157747e92b521220774da8b
M: 2384a45084fec6db31e3331912c92379c45bd4bd 192.168.4.56:6356
   slots:6827-10922 (4096 slots) master
   1 additional replica(s)
S: a02f23b9cd8410c03d047433d48ad4b73e6dea19 192.168.4.58:6358
   slots: (0 slots) slave
   replicates 44077cd747b4b32b9026a8f8ae2c0a1a4cca7441
M: 44077cd747b4b32b9026a8f8ae2c0a1a4cca7441 192.168.4.57:6357
   slots:0-1364,5461-6826,10923-12287 (4096 slots) master
   1 additional replica(s)
S: 43eb87ced708e2845e5b58618c817e2e1535e882 192.168.4.54:6354
   slots: (0 slots) slave
   replicates 3680239417226f1e0cc1b744e822de5c85b84890
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.
自动分配给57
 
客户端连接主库58 可以查看到数据
]# redis-cli -c -h 192.168.4.58 -p 6358
192.168.4.58:6358> set t2 333
-> Redirected to slot [4748] located at 192.168.4.51:6351
OK
192.168.4.51:6351> keys *
1) "t2"
192.168.4.51:6351> set t3 444
-> Redirected to slot [685] located at 192.168.4.57:6357
OK
192.168.4.57:6357> keys *
1) "t3"
192.168.4.57:6357> set t4 444
-> Redirected to slot [12874] located at 192.168.4.53:6353
OK
192.168.4.53:6353> keys *
1) "t4"
2) "key"
3) "x"
 
2.2 从集群里移除主机
2.2.1 移除slave角色主机  (移除192.168.4.58,51操作)
redis-trib.rb del-node 任意主机 被移除主机ID(slave主机没有haxi槽,可直接移除)
]# redis-trib.rb del-node 192.168.4.51:6351 a02f23b9cd8410c03d047433d48ad4b73e6dea19
>>> Removing node a02f23b9cd8410c03d047433d48ad4b73e6dea19 from cluster 192.168.4.51:6351
>>> Sending CLUSTER FORGET messages to the cluster...
>>> SHUTDOWN the node.

]# redis-trib.rb check 192.168.4.51:6351
此时没有58的slave信息
 
2.2.2 移除master角色主机  (移除 192.168.4.57 51操作)
释放占用的hash槽
]# redis-trib.rb reshard 192.168.4.51:6351
    指定移出hash槽个数     4096
    指定接收hash槽主机ID  写任意一个主库ID值
   Source node #1:     写57主机的ID值
   Source node #2:     done
    同意这样分片             yes

移除master主机
]# redis-trib.rb del-node 192.168.4.51:6351 44077cd747b4b32b9026a8f8ae2c0a1a4cca7441
检测集群
]# redis-trib.rb check 192.168.4.51:6351
>>> Performing Cluster Check (using node 192.168.4.51:6351)
M: d9e8b7d81f4dff3d3157747e92b521220774da8b 192.168.4.51:6351
   slots:1365-5460 (4096 slots) master
   1 additional replica(s)
S: 47b98f4c7d16486e5f8032e7a420675a025dd090 192.168.4.52:6352
   slots: (0 slots) slave
   replicates 2384a45084fec6db31e3331912c92379c45bd4bd
M: 3680239417226f1e0cc1b744e822de5c85b84890 192.168.4.53:6353
   slots:12288-16383 (4096 slots) master
   1 additional replica(s)
S: e528e231af6cb62ade68202e9fee2b5b090c9025 192.168.4.55:6355
   slots: (0 slots) slave
   replicates d9e8b7d81f4dff3d3157747e92b521220774da8b
M: 2384a45084fec6db31e3331912c92379c45bd4bd 192.168.4.56:6356
   slots:0-1364,5461-12287 (8192 slots) master
   1 additional replica(s)
S: 43eb87ced708e2845e5b58618c817e2e1535e882 192.168.4.54:6354
   slots: (0 slots) slave
   replicates 3680239417226f1e0cc1b744e822de5c85b84890
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.
 
重新平均分配hash槽
]# redis-trib.rb rebalance 192.168.4.51:6351
]# redis-trib.rb check 192.168.4.51:6351 查看
>>> Performing Cluster Check (using node 192.168.4.51:6351)
M: d9e8b7d81f4dff3d3157747e92b521220774da8b 192.168.4.51:6351
   slots:0-5461 (5462 slots) master
   1 additional replica(s)
S: 47b98f4c7d16486e5f8032e7a420675a025dd090 192.168.4.52:6352
   slots: (0 slots) slave
   replicates 2384a45084fec6db31e3331912c92379c45bd4bd
M: 3680239417226f1e0cc1b744e822de5c85b84890 192.168.4.53:6353
   slots:5462-6826,12288-16383 (5461 slots) master
   1 additional replica(s)
S: e528e231af6cb62ade68202e9fee2b5b090c9025 192.168.4.55:6355
   slots: (0 slots) slave
   replicates d9e8b7d81f4dff3d3157747e92b521220774da8b
M: 2384a45084fec6db31e3331912c92379c45bd4bd 192.168.4.56:6356
   slots:6827-12287 (5461 slots) master
   1 additional replica(s)
S: 43eb87ced708e2845e5b58618c817e2e1535e882 192.168.4.54:6354
   slots: (0 slots) slave
   replicates 3680239417226f1e0cc1b744e822de5c85b84890
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.

把redis集群里的主机 恢复为独立的redis服务器(51-58)
]# redis-cli -h 192.168.4.51 -p 6351 shutdown
]# rm -rf /var/lib/redis/6379/*
]# vim /etc/redis/6379.conf  (把与集群配置相关的 3项 注释)
]# /etc/init.d/redis_6379 start
]# netstat -utnlp | grep redis-server

原文地址:https://www.cnblogs.com/luwei0915/p/12260729.html

时间: 2024-10-10 05:11:23

34_创建Redis集群 管理集群的相关文章

【MSP是什么】MSP认证之成功的项目群管理

同项目管理相比,项目群管理是为了实现项目群的战略目标与利益,而对一组项目进行的统一协调管理. 项目群管理 项目群管理是以项目管理为核心.单个项目上进行日常性的项目管理,项目群管理是对多个项目进行的总体控制和协调. 项目群管理不直接参与对每个项目的日常管理,所做的工作侧重在整体上进行规划.控制和协调,指导各个项目的具体管理工作(表明项目群管理在企业级多层次项目管理体系和目标中的地位). 新的概念 项目群管 理(Programme)是一个比较新的概念,作为项目概念的延伸,其含义到尚未取得一致的认识,

MSP项目群管理

在全球商业规则巨变的今天,当今掌控变革最有效的方法是项目群管理(Program Management), 而英国政府提出的MSP (Managing Successful Programme),成功的项目群管理) 项目群管理体系正是这一前沿的代表,它综合了全球五百强企业项目群管理的优秀实践.通过对项目群进行管理,成功实现企业变革.MSP将项目群管理定义为:"协调组织.指导和实施一系列项目和转换活动的行为,目的是为了通过一系列变革成果,实现对业务具有战略重要性的收益".今日之中国,每一个

Redis集群管理

原文链接:http://blog.csdn.net/xyang81/article/details/51895011 在上一篇<Redis3.2集群担建与验证>文章中分享了集群的详细担建过程,本篇主要分享集群管理的常见操作,如:添加节点.删除节点.slot分配.如果你还没有担建集群环境,建议先看上篇<Redis3.2集群担建与验证>过程,再来阅读本文比较好理解. 1.集群管理常用命令 // 集群(cluster) CLUSTER INFO 打印集群的状态信息 CLUSTER NOD

redis演练(9) redis Cluster 集群管理&failover情况

<redis演练(8) redis Cluster 集群环境安装>,简单阐述了如何安装redis集群环境. 集群环境,主要包括2部分. 1.配置每个节点的配置信息(redis.conf),尤其开启cluster 2.创建集群redis-trib.rb创建集群. 过程非常简单,但非常繁琐,尤其配置各个集群节点的配置信息,如果有一定数量,工作量也不小. 没关系,redis提供了一款cluster工具,能快速构造集群环境.本章的主要内容是介绍redis提供的集群工具. 1.使用create-clus

ruby redis的集群管理器

#========================================================================================== # => redis集群管理器 #========================================================================================== class CacheGroupManager attr_reader :redis_groups

redis cluster集群管理工具redis-trib.rb功能小结

redis-trib.rb是redis官方推出的管理redis集群的工具,集成在redis的源码src目录下,是基于redis提供的集群命令封装成简单.便捷.实用的操作工具.redis-trib.rb是redis作者用ruby完成的.所以要执行redis-trib.rb命令,需要Ruby,具体可参考:http://www.cnblogs.com/kevingrace/p/7846324.html [[email protected] ~]# /data/redis-4.0.6/src/redis

Redis 集群管理常见操作

Redis 内置客户端 redis-cli 通过 --cluster 选项集成了多个 Redis 集群管理工具, 这些工具可以执行创建集群.向集群中添加或移除节点.对集群实施重分片以及负载均衡等操作, 它们每一个都非常强大:$ redis-cli --cluster help``` Cluster Manager Commands:create host1:port1 ... hostN:portN--cluster-replicas <arg>check host:portinfo host

redis主从切换的集群管理

网 站的访问量慢慢上来了.为了网站的性能方面,开始用了redis做缓存策略.刚开始的时候,redis是一个单点,当一台机器岩机的时候,redis的 服务完全停止,这时就会影响其他服务的正常运行.费话不多说了,下面利用redis sentinel做一个主从切换的集群管理.做这个集群管理的时候,查过很多资料才完全了解,他是怎么做的. java 客户端请看: http://blog.mkfree.com/posts/52b146e6479e5a64742fddd0 参考资料:http://redis.

利用ansible modules模块来自定义集群管理

前沿: 在一些个特定环境下,用ansible做集群管理还是很棒的,这两天看了他的模块,官方提供了很多,就算不够,你也可以自定义定制. 话说我挺喜欢他的modules模块的,够直接 !!! 我这里就说些常见的ansible的modules吧. 下面的ansible service一看大家就懂了,就是服务状态的管理模块 [[email protected] ~ ]$ ansible web -m service -a "name=nginx state=started" 10.150.14