如何解决redis集群"等待集群加入"问题?

时间:2016-09-19 08:27:32

标签: redis redis-cluster

我有3台机器并为redis集群创建了6个节点,我已经在几个月前成功创建了它,但它现在已经放弃了,我尽力修复它,但它不起作用,所以我清理所有数据并重新创建从零开始,当我使用以下命令创建集群,它在这里阻塞,等待节点加入集群,我做了一些研究,我清理我的数据,一次又一次地记录,一次又一次地做,但它仍然没有工作。

redis-trib.rb create --replicas 1 10.2.1.208:6379 10.2.1.208:6380 10.2.1.209:6379 10.2.1.209:6380 10.2.1.15:6379 10.2.1.15:6380

show the result

redis-trib.rb create --replicas 1 10.2.1.208:6379 10.2.1.208:6380 10.2.1.209:6379 10.2.1.209:6380 10.2.1.15:6379 10.2.1.15:6380
>>> Creating cluster
>>> Performing hash slots allocation on 6 nodes...
Using 3 masters:
10.2.1.208:6379
10.2.1.209:6379
10.2.1.15:6379
Adding replica 10.2.1.209:6380 to 10.2.1.208:6379
Adding replica 10.2.1.208:6380 to 10.2.1.209:6379
Adding replica 10.2.1.15:6380 to 10.2.1.15:6379
M: 73b3b99bb17de63aa99eaf592376f0a06feb3d66 10.2.1.208:6379
   slots:0-5460 (5461 slots) master
S: 05b33ed6691797faaf7ccec1541396472b9d2866 10.2.1.208:6380
   replicates f14702ebb1462b313dd7eb4809ec50e30e4eef36
M: f14702ebb1462b313dd7eb4809ec50e30e4eef36 10.2.1.209:6379
   slots:5461-10922 (5462 slots) master
S: 3a9f433a8503281b0ddfc6ec69016908735053b8 10.2.1.209:6380
   replicates 73b3b99bb17de63aa99eaf592376f0a06feb3d66
M: 2fd97e8842828dba6b425b6a30e764fb06915737 10.2.1.15:6379
   slots:10923-16383 (5461 slots) master
S: c46db592d49bc1e9d8b5efb27b9799929c5186a4 10.2.1.15:6380
   replicates 2fd97e8842828dba6b425b6a30e764fb06915737
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...........................................................................^C/usr/local/bin/redis-trib.rb:652:in `sleep': Interrupt
        from /usr/local/bin/redis-trib.rb:652:in `wait_cluster_join'
        from /usr/local/bin/redis-trib.rb:1305:in `create_cluster_cmd'
        from /usr/local/bin/redis-trib.rb:1695:in `<main>'

4 个答案:

答案 0 :(得分:3)

来自the cluster tutorial on the official Redis website

  

每个Redis群集节点都需要打开两个TCP连接。正常   用于为客户端提供服务的Redis TCP端口,例如6379,以及端口   通过向数据端口添加10000获得,因此在示例中为16379。

     

第二个端口用于集群总线,即a   使用二进制协议的节点到节点通信信道。该   节点使用集群总线进行故障检测和配置   更新,故障转移授权等。客户不应该尝试   与集群总线端口通信,但始终与正常   Redis命令端口,但请确保打开您的两个端口   防火墙,否则Redis群集节点将无法执行   通信。

     

命令端口和集群总线端口偏移是固定的并且始终是   10000

我使用的是AWS,但没有打开导致此问题的端口16379和16380.

答案 1 :(得分:0)

如果这6个节点之间没有防火墙问题,则可以检查 redis.conf 中的 bind 设置。

您应该将redis服务绑定到LAN IP上, 但还有一件事:

在LAN IP之后删除127.0.0.1或将127.0.0.1移至末尾!

就像这样:bind 10.2.1.x 127.0.0.1bind 10.2.1.x

当我在3台服务器上的3个节点之间创建集群时,我遇到了这个问题,等待集群永久加入。至少在Redis 5.0中,当您将127.0.0.1放在LAN IP的前面时,这可能是redis中的错误。

答案 2 :(得分:0)

这些答案都不适合我,但我发现以下博客有帮助:

https://linux.m2osw.com/redis-infamous-waiting-cluster-join-message

问题是因为我创建了一个原始服务器并克隆它以生成其他两个节点。克隆的节点使用相同的节点 ID,而 redis 不喜欢这样。

解决方案是停止redis服务器,然后删除nodes.conf文件,其实际名称在redis.conf文件中定义。我的实际上被称为nodes-6379.conf。然后重启redis服务器。在所有节点上执行此操作。

答案 3 :(得分:0)

如果您使用 127.0.0.1 作为主机名而不是使用 IP 地址,您也可能会看到此问题。在这种情况下,您需要更改它以使用 IP 地址作为主机名。 https://stackoverflow.com/a/36080707/5159284

相关问题