2016-07-01 57 views
0

我有2个节点,我想使群集出来。我已经安装了RabbitMq。RabbitMQ无法连接群集中的节点

现在我停在第二个节点兔应用程序,并试图加入集群类似下面的命令: 须藤rabbitmqctl join_cluster兔@ rabbit1

但它抛出以下错误

> DIAGNOSTICS 
> =========== 
> 
> attempted to contact: [[email protected]] 
> 
> [email protected]: * unable to connect to epmd (port 4369) on rabbit1: 
> nxdomain (non-existing domain) 
> 
> 
> current node details: 
> - node name: '[email protected]' 
> - home dir: /var/lib/rabbitmq 
> - cookie hash: A85MNn8I1UhtrGozi+m/2g== 

我下面这个链接:https://www.rabbitmq.com/clustering.html errang cookie在节点中都是相同的,4369端口在节点中都是打开的。

回答

1

有很多方法来解决这个问题。

在RabbitMQ的-3.6.9和Erlang v8.3.3

  • 正确和同一文件的.erlang.cookie

    chgrp rabbitmq /var/lib/rabbitmq/.erlang.cookie 
    chown rabbitmq /var/lib/rabbitmq/.erlang.cookie 
    chmod 400 /var/lib/rabbitmq/.erlang.cookie 
    
  • 正确的主机和主机名

    • 主持人:

      cat /etc/hosts 
      

      结果:

      127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 
      ::1   localhost localhost.localdomain localhost6 localhost6.localdomain6 
      
      127.0.0.1  rabbitmq252 
      192.168.4.249 rabbitmq249 
      192.168.4.251 rabbitmq251 
      192.168.4.252 rabbitmq252 
      
    • 主机名:

      cat /etc/hostname 
      

      结果:

      rabbitmq252 
      
  • 删除群集节点

    如果集群已经有节点或状态改变,或者甚至是某个节点的其他节点。您可以通过在命令删除节点:

    rabbitmqctl forget_cluster_node [email protected] 
    
  • 清除二郎Mnesia的数据库

    /var/lib/rabbitmq/文件路径,有三个文件,如erl_crash.dump mnesia .erlang.cookie

    rm -rf /var/lib/rabbitmq/* 
    
  • 杀的RabbitMQ

    ps aux|grep rabbitmq 
    kill -9 remaining_process 
    
  • 重新安装的RabbitMQ和Erlang进程

无论如何,如果你遇到的问题,您应该:

  1. [R EAD服务

    systemctl status rabbitmq-server.service -l 
    # or 
    service rabbitmq-server status 
    # or 
    journalctl -ex 
    
  2. 的状态来服务

    的日志下可以找到服务的状态的路径。

    cat /var/log/rabbitmq/[email protected] 
    # or 
    cat /var/log/rabbitmq/[email protected] 
    
  3. 阅读港口

    netstat -ntlp 
    
-1

我通过在/ etc/hosts文件中添加主机来解决此问题。

+0

你应该标明陈建的答案正确的状态,所修改'/等/ hosts'记 –

0

这也取决于版本,所以你可以选择使用join_clustercluster