Redis物理集群

2019-06-19  本文已影响0人  我把今生当成了来世

Redis物理 集群配置

配置文件

开启服务

image.png
./redis-cli -h 10.1.26.17 -p 7005
10.1.26.17:7005> set name dalton
image.png
你以为这就好了,其实没有,真正的集群还没有创建的。如果有不清楚或遇到下面这个问题的可以直接查看帮助文章,文章作者写的很详细。

一番查询之后:
(error) CLUSTERDOWN Hash slot not served 不提供集群的散列槽
由于配置并启动了 Redis 集群服务,但是他们暂时还并不在一个集群中,互相直接发现不了,而且还没有可存储的位置,就是所谓的slot(槽)

帮助文章:http://blog.itpub.net/31015730/viewspace-2155989

创建集群

➜  src ./redis-cli --cluster create 10.1.26.17:7003 10.1.26.17:7004 10.1.26.17:7005
>>> Performing hash slots allocation on 3 nodes...
Master[0] -> Slots 0 - 5460
Master[1] -> Slots 5461 - 10922
Master[2] -> Slots 10923 - 16383
M: 0a3285e765077189817310e77a679545921dd87d 10.1.26.17:7003
   slots:[0-5460] (5461 slots) master
M: ff2b8b1bc1dd7bdd189e940aed9c3fabc4402e28 10.1.26.17:7004
   slots:[5461-10922] (5462 slots) master
M: 13cd4044fd375e398388c422886798696a0524ce 10.1.26.17:7005
   slots:[10923-16383] (5461 slots) master
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 10.1.26.17:7003)
M: 0a3285e765077189817310e77a679545921dd87d 10.1.26.17:7003
   slots:[0-5460] (5461 slots) master
M: ff2b8b1bc1dd7bdd189e940aed9c3fabc4402e28 10.1.26.17:7004
   slots:[5461-10922] (5462 slots) master
M: 13cd4044fd375e398388c422886798696a0524ce 10.1.26.17:7005
   slots:[10923-16383] (5461 slots) master
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.

PS:集群的搭建就完成了,具体的使用还需要自己去coding。

上一篇 下一篇

猜你喜欢

热点阅读