【问题标题】:Redis3 cluster infinite waiting for the cluster to joinRedis3集群无限等待集群加入
【发布时间】:2016-09-26 16:10:36
【问题描述】:

我有 2 台服务器和 3 个 redis3 实例。我有一个cluster-nodes 目录,其中包含每个实例的所有数据。在这里。

cluster-nodes/
|-- 7777
|   |-- db01
|   |  -- nodes-7777.conf
|   -- redis.conf
|-- 7778
|   |-- db02
|   |   -- nodes-7778.conf
|   -- redis.conf
-- 7779
    |-- db03
    |   -- nodes-7779.conf
    -- redis.conf

这是我在7777 目录下的配置文件redis.conf

pidfile /var/run/redis/redis-7777.pid
port 7777
dir /opt/redis/cluster-nodes/7777/db01/
cluster-enabled yes
cluster-config-file nodes-7777.conf
cluster-node-timeout 15000

当我尝试启动 redis 时,我得到了

./redis-trib.rb create --replicas 1 127.0.0.1:7777 127.0.0.1:7778 127.0.0.1:7779 192.168.56.41:7777 192.168.56.41:7778 192.168.56.41:7779
>>> Creating cluster
Connecting to node 127.0.0.1:7777: OK
Connecting to node 127.0.0.1:7778: OK
Connecting to node 127.0.0.1:7779: OK
Connecting to node 192.168.56.41:7777: OK
Connecting to node 192.168.56.41:7778: OK
Connecting to node 192.168.56.41:7779: OK
>>> Performing hash slots allocation on 6 nodes...
Using 3 masters:
127.0.0.1:7777
192.168.56.41:7777
127.0.0.1:7778
Adding replica 192.168.56.41:7778 to 127.0.0.1:7777
Adding replica 127.0.0.1:7779 to 192.168.56.41:7777
Adding replica 192.168.56.41:7779 to 127.0.0.1:7778
M: 209d68fae9c64855d34972f660232eb96370a669 127.0.0.1:7777
   slots:0-5460 (5461 slots) master
M: 62e2b167a287b94b5154f7b9b0f226345baa81b7 127.0.0.1:7778
   slots:10923-16383 (5461 slots) master
S: 36ed59deceb01788db76abc0c2f22925a27295fc 127.0.0.1:7779
   replicates 2760b5fcc99c6563a7cf8deea159efb012309238
M: 2760b5fcc99c6563a7cf8deea159efb012309238 192.168.56.41:7777
   slots:5461-10922 (5462 slots) master
S: 16bf95ba9cb743c2a3caecaab5c2fd5121d80557 192.168.56.41:7778
   replicates 209d68fae9c64855d34972f660232eb96370a669
S: 30e7a5b4a94b5ff3a09f4809d6fd62edb2279b0e 192.168.56.41:7779
   replicates 62e2b167a287b94b5154f7b9b0f226345baa81b7
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./redis-trib.rb:534:in `sleep': Interrupt
    from ./redis-trib.rb:534:in `wait_cluster_join'
    from ./redis-trib.rb:1007:in `create_cluster_cmd'
    from ./redis-trib.rb:1373:in `<main>'

这是第一台服务器上集群节点的输出

62e2b167a287b94b5154f7b9b0f226345baa81b7 127.0.0.1:7778 master - 0 1435144555558 2 connected 10923-16383
36ed59deceb01788db76abc0c2f22925a27295fc 127.0.0.1:7779 master - 0 1435144554554 3 connected
209d68fae9c64855d34972f660232eb96370a669 127.0.0.1:7777 myself,master - 0 0 1 connected 0-5460

这是从第二个开始

16bf95ba9cb743c2a3caecaab5c2fd5121d80557 127.0.0.1:7778 master - 0 1435144648065 5 connected
30e7a5b4a94b5ff3a09f4809d6fd62edb2279b0e 127.0.0.1:7779 master - 0 1435144647057 6 connected
2760b5fcc99c6563a7cf8deea159efb012309238 127.0.0.1:7777 myself,master - 0 0 4 connected 5461-10922

似乎都是以大师身份开始的?我的配置有问题吗? 谢谢。

附言当我尝试相同的配置并在一台服务器上启动所有实例时,一切正常。

【问题讨论】:

    标签: redis


    【解决方案1】:

    我的问题是我使用本地主机地址启动服务,

    ./redis-trib.rb create --replicas 1 127.0.0.1:7777 127.0.0.1:7778 127.0.0.1:7779 192.168.56.41:7777 192.168.56.41:7778 192.168.56.41:7779
    

    为了解决127.0.0.1应该替换为本地节点的IP地址,即

    ./redis-trib.rb create --replicas 1 192.168.56.40:7777 192.168.56.40:7778 192.168.56.40:7779 192.168.56.41:7777 192.168.56.41:7778 192.168.56.41:7779
    

    【讨论】:

      【解决方案2】:

      请检查 17777 17778...端口,集群需要这些端口才能通信。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2018-10-03
        • 2021-02-15
        • 1970-01-01
        • 1970-01-01
        • 2020-04-07
        • 2019-05-20
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多