redis集群等待集群加入私有专有网络

zour9fqk  于 2021-06-09  发布在  Redis
关注(0)|答案(1)|浏览(349)

我有3个ec2示例,redis的运行方式如下:
服务器001:10.0.1.203,端口:6379
服务器002:10.0.1.202,端口:6380
服务器003:10.0.1.190,端口:6381
每个的配置文件:


# bind 127.0.0.1

protected-mode no
port PORT
pidfile /var/run/redis_PORT.pid
cluster-enabled yes
cluster-config-file nodes-PORT.conf
cluster-node-timeout 15000

我可以通过redis连接到每台服务器上的每一个。
但是当我运行集群创建时,脚本永远不会在服务器001上结束。

root@ip-10-0-1-203:~/redis-stable# redis-cli --cluster create 10.0.1.203:6379 10.0.1.202:6380 10.0.1.190:6381
>>> Performing hash slots allocation on 3 nodes...
Master[0] -> Slots 0 - 5460
Master[1] -> Slots 5461 - 10922
Master[2] -> Slots 10923 - 16383
M: 4c0b7609e5d906ff58d67ab446bbd9e20833e0db 10.0.1.203:6379
   slots:[0-5460] (5461 slots) master
M: a5dbd72815a1875b58a0cc0fd6a52dc0b76735b7 10.0.1.202:6380
   slots:[5461-10922] (5462 slots) master
M: 14d39c0876a982cadd50f301a3d35715171279c0 10.0.1.190:6381
   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
....................................................................................................................................................................................................................................................................................................................................

服务器日志:

44119:M 02 Nov 2020 13:30:03.477 * Ready to accept connections
44119:M 02 Nov 2020 13:30:45.362 # configEpoch set to 0 via CLUSTER RESET HARD
44119:M 02 Nov 2020 13:30:45.362 * Node hard reset, now I'm a5dbd72815a1875b58a0cc0fd6a52dc0b76735b7
44119:M 02 Nov 2020 13:30:59.352 # configEpoch set to 2 via CLUSTER SET-CONFIG-EPOCH

服务器日志:

44033:M 02 Nov 2020 13:30:50.695 # configEpoch set to 0 via CLUSTER RESET HARD
44033:M 02 Nov 2020 13:30:50.695 * Node hard reset, now I'm 14d39c0876a982cadd50f301a3d35715171279c0
44033:M 02 Nov 2020 13:30:59.346 # configEpoch set to 3 via CLUSTER SET-CONFIG-EPOCH

我在配置上遗漏了什么?

vi4fp9gy

vi4fp9gy1#

可能在ec2示例上无法访问redis集群端口。
根据redis集群规范:
每个redis集群节点都有一个额外的tcp端口,用于接收来自其他redis集群节点的传入连接。此端口与用于接收来自客户端的传入连接的正常tcp端口的偏移量固定。要获得redis集群端口,需要在普通命令端口上加10000。例如,如果redis节点正在端口6379上侦听客户端连接,那么集群总线端口16379也将被打开。

相关问题