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

发布于 2022-09-11 17:43:21 字数 809 浏览 22 评论 0

根据官方网站的教程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
求解答!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

轮廓§ 2022-09-18 17:43:21

在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端口,才能建立起集群。

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文