redis 集群 ruby 版本

localhost:src spring$ ./redis-cli -h 127.0.0.1 -p 6381
127.0.0.1:6381> 
127.0.0.1:6381> 
127.0.0.1:6381> 
127.0.0.1:6381> cluster info
cluster_state:fail
cluster_slots_assigned:0
cluster_slots_ok:0
cluster_slots_pfail:0
cluster_slots_fail:0
cluster_known_nodes:1
cluster_size:0
cluster_current_epoch:0
cluster_my_epoch:0
cluster_stats_messages_sent:0
cluster_stats_messages_received:0
127.0.0.1:6381> 
127.0.0.1:6381> 
127.0.0.1:6381> 
127.0.0.1:6381> 
127.0.0.1:6381> 
localhost:src spring$ ./redis-trib.rb create --replicas 1 127.0.0.1:6381 127.0.0.1:6382 127.0.0.1:6383 127.0.0.1:6384 127.0.0.1:6385 127.0.0.1:6386
>>> Creating cluster
>>> Performing hash slots allocation on 6 nodes...
Using 3 masters:
127.0.0.1:6381
127.0.0.1:6382
127.0.0.1:6383
Adding replica 127.0.0.1:6385 to 127.0.0.1:6381
Adding replica 127.0.0.1:6386 to 127.0.0.1:6382
Adding replica 127.0.0.1:6384 to 127.0.0.1:6383
>>> Trying to optimize slaves allocation for anti-affinity
[WARNING] Some slaves are in the same host as their master
M: ee0952d08656412902de4cdd23290a37a157cfe7 127.0.0.1:6381
   slots:0-5460 (5461 slots) master
M: ae61ba8de961b6655891421e618be4fc4e5a3d35 127.0.0.1:6382
   slots:5461-10922 (5462 slots) master
M: 595b06e71c04f7347f750140654b72fe00101f10 127.0.0.1:6383
   slots:10923-16383 (5461 slots) master
S: 61491da5c989be01cde9106abe9bed3717fdc5c4 127.0.0.1:6384
   replicates ee0952d08656412902de4cdd23290a37a157cfe7
S: b57ee0f159d7e491e2502159edb58d0636faf489 127.0.0.1:6385
   replicates ae61ba8de961b6655891421e618be4fc4e5a3d35
S: 31e3473913abc223dfc08f4294cef3c2b0481dcb 127.0.0.1:6386
   replicates 595b06e71c04f7347f750140654b72fe00101f10
Can I set the above configuration? (type 'yes' to accept): yes
>>> Nodes configuration updated
>>> Assign a different config epoch to each node
>>> Sending CLUSTER MEET messages to join the cluster
Waiting for the cluster to join....
>>> Performing Cluster Check (using node 127.0.0.1:6381)
M: ee0952d08656412902de4cdd23290a37a157cfe7 127.0.0.1:6381
   slots:0-5460 (5461 slots) master
   1 additional replica(s)
M: 595b06e71c04f7347f750140654b72fe00101f10 127.0.0.1:6383
   slots:10923-16383 (5461 slots) master
   1 additional replica(s)
S: b57ee0f159d7e491e2502159edb58d0636faf489 127.0.0.1:6385
   slots: (0 slots) slave
   replicates ae61ba8de961b6655891421e618be4fc4e5a3d35
S: 31e3473913abc223dfc08f4294cef3c2b0481dcb 127.0.0.1:6386
   slots: (0 slots) slave
   replicates 595b06e71c04f7347f750140654b72fe00101f10
S: 61491da5c989be01cde9106abe9bed3717fdc5c4 127.0.0.1:6384
   slots: (0 slots) slave
   replicates ee0952d08656412902de4cdd23290a37a157cfe7
M: ae61ba8de961b6655891421e618be4fc4e5a3d35 127.0.0.1:6382
   slots:5461-10922 (5462 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.
localhost:src spring$ ./redis-cli -h 127.0.0.1 -p 6381
127.0.0.1:6381> 
127.0.0.1:6381> 
127.0.0.1:6381> 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:89
cluster_stats_messages_pong_sent:87
cluster_stats_messages_sent:176
cluster_stats_messages_ping_received:82
cluster_stats_messages_pong_received:89
cluster_stats_messages_meet_received:5
cluster_stats_messages_received:176
127.0.0.1:6381> get a
(error) MOVED 15495 127.0.0.1:6383
127.0.0.1:6381> 
localhost:src spring$ ./redis-cli -h 127.0.0.1 -p 6383
127.0.0.1:6383> get a
(nil)
127.0.0.1:6383> 
127.0.0.1:6383> get age
(error) MOVED 741 127.0.0.1:6381
127.0.0.1:6383> 
127.0.0.1:6383> 
127.0.0.1:6383> 
localhost:src spring$ ./redis-cli -h 127.0.0.1 -p 6381
127.0.0.1:6381> 
127.0.0.1:6381> get age
(nil)
127.0.0.1:6381> get age
(nil)
127.0.0.1:6381> get age
(nil)
127.0.0.1:6381> get age
"18"
127.0.0.1:6381> get age
"18"
127.0.0.1:6381> 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:167
cluster_stats_messages_pong_sent:165
cluster_stats_messages_sent:332
cluster_stats_messages_ping_received:160
cluster_stats_messages_pong_received:167
cluster_stats_messages_meet_received:5
cluster_stats_messages_received:332
127.0.0.1:6381> 
127.0.0.1:6381> 
127.0.0.1:6381> cluster nodes
ee0952d08656412902de4cdd23290a37a157cfe7 127.0.0.1:6381@16381 myself,master - 0 1558008340000 1 connected 0-5460
595b06e71c04f7347f750140654b72fe00101f10 127.0.0.1:6383@16383 master - 0 1558008343047 3 connected 10923-16383
b57ee0f159d7e491e2502159edb58d0636faf489 127.0.0.1:6385@16385 slave ae61ba8de961b6655891421e618be4fc4e5a3d35 0 1558008343000 5 connected
31e3473913abc223dfc08f4294cef3c2b0481dcb 127.0.0.1:6386@16386 slave 595b06e71c04f7347f750140654b72fe00101f10 0 1558008342037 6 connected
61491da5c989be01cde9106abe9bed3717fdc5c4 127.0.0.1:6384@16384 slave ee0952d08656412902de4cdd23290a37a157cfe7 0 1558008341001 4 connected
ae61ba8de961b6655891421e618be4fc4e5a3d35 127.0.0.1:6382@16382 master - 0 1558008344080 2 connected 5461-10922
127.0.0.1:6381> 
127.0.0.1:6381> 
127.0.0.1:6381> 

前提先设置6个节点的配置文件端口号及是集群的状态,并且全部启动

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

5icode.top

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值