redis5.0 在一台linux上建立集群

根据官方网站的教程https://redis.io/topics/clust...
在一台linux主机上模拟redis集群,其中建立集群的命令如下:

redis-cli --cluster create 127.0.0.1:7000 127.0.0.1:7001 \
127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:7004 127.0.0.1:7005 \
--cluster-replicas 1

我将命令中127.0.0.1 换成linux主机的真实IP后就一直卡在
waiting for the cluster to join...........

clipboard.png

如果IP是127.0.0.1 是可以成功的,如下

clipboard.png
但是这样成功后,使用另一台Linux主机连接这个redis集群会出现问题:

clipboard.png
求解答!

阅读 3.1k
1 个回答

在redis官网,有下面的说明

Note that for a Redis Cluster to work properly you need, for each node:

The normal client communication port (usually 6379) used to communicate with clients to be open to all the clients that need to reach the cluster, plus all the other cluster nodes (that use the client port for keys migrations).
The cluster bus port (the client port + 10000) must be reachable from all the other cluster nodes.
If you don't open both TCP ports, your cluster will not work as expected.

The cluster bus uses a different, binary protocol, for node to node data exchange, which is more suited to exchange information between nodes using little bandwidth and processing time.

也就是说,在这里,我除了要开放7001端口,还要在云服务器控制台开放17001端口,才能建立起集群。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏