【问题标题】:Erlang - Ejabberd join_cluster Error: {no_ping ...}Erlang - Ejabberd join_cluster 错误:{no_ping ...}
【发布时间】:2016-08-20 03:51:05
【问题描述】:

您好,我一直在尝试建立一个 ejabberd 集群。 但是,在尝试从 node2 加入 node1 时,我收到一条错误消息

在节点 2 上:

# ejabberdctl join_cluster ejabberd@<internal ip of node1>
Error: {no_ping,'ejabberd@<internal ip of node1>'}

我可以清楚地从 node2 ping node1。

两个节点都托管在 AWS 上的同一区域中。 我尝试允许节点 1 上的所有流量。 两者都有相同的 .erlang.cookie。

不知道为什么我继续收到该错误。

# ejabberdctl status
The node 'ejabberd@<internal ip of node1>' is started with status: started
ejabberd 16.03.107 is running in that node

# netstat -lnptu
tcp        0      0 0.0.0.0:4369            0.0.0.0:*               LISTEN      2190/epmd       
tcp        0      0 0.0.0.0:5269            0.0.0.0:*               LISTEN      2233/beam.smp   
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      975/sshd        
tcp        0      0 0.0.0.0:52189           0.0.0.0:*               LISTEN      2233/beam.smp   
tcp        0      0 0.0.0.0:5280            0.0.0.0:*               LISTEN      2233/beam.smp   
tcp        0      0 0.0.0.0:5222            0.0.0.0:*               LISTEN      2233/beam.smp   
tcp6       0      0 :::4369                 :::*                    LISTEN      2190/epmd       
tcp6       0      0 :::22                   :::*                    LISTEN      975/sshd        

node1 上的 ejabberdctl.cfg :

ERLANG_NODE=ejabberd@<internal IP of node1>

node1 上的 ejabberd.yml:

loglevel: 4

log_rotate_size: 10485760
log_rotate_date: ""
log_rotate_count: 1

log_rate_limit: 100





hosts:
  - "<external ip of node1>"



listen: 
  - 
    port: 5222
    module: ejabberd_c2s
    max_stanza_size: 65536
    shaper: c2s_shaper
    access: c2s
  - 
    port: 5269
    module: ejabberd_s2s_in


  - 
    port: 5280
    module: ejabberd_http
    request_handlers:
      "/websocket": ejabberd_http_ws
    web_admin: true
    http_bind: true
    captcha: true









auth_method: internal
















shaper:
  normal: 1000

  fast: 50000

max_fsm_queue: 1000

acl:

  local: 
    user_regexp: ""


  loopback:
    ip:
      - "127.0.0.0/8"



access:
  max_user_sessions: 
    all: 10
  max_user_offline_messages: 
    admin: 5000
    all: 100
  local: 
    local: allow
  c2s: 
    blocked: deny
    all: allow
  c2s_shaper: 
    admin: none
    all: normal
  s2s_shaper: 
    all: fast
  announce: 
    admin: allow
  configure: 
    admin: allow
  muc_admin: 
    admin: allow
  muc_create: 
    local: allow
  muc: 
    all: allow
  pubsub_createnode: 
    local: allow
  register: 
    all: allow
  trusted_network: 
    loopback: allow




language: "en"







modules: 
  mod_adhoc: {}
  mod_announce: # recommends mod_adhoc
    access: announce
  mod_blocking: {} # requires mod_privacy
  mod_caps: {}
  mod_carboncopy: {}
  mod_client_state: {}
  mod_configure: {} # requires mod_adhoc
  mod_disco: {}
  mod_irc: {}
  mod_http_bind: {}
  mod_last: {}
  mod_muc: 
    host: "conference.@HOST@"
    access: muc
    access_create: muc_create
    access_persistent: muc_create
    access_admin: muc_admin
  mod_muc_admin: {}
  mod_offline: 
    access_max_user_messages: max_user_offline_messages
  mod_ping: {}
  mod_privacy: {}
  mod_private: {}
  mod_pubsub: 
    access_createnode: pubsub_createnode
    ignore_pep_from_offline: true
    last_item_cache: false
    plugins: 
      - "flat"
      - "hometree"
      - "pep" # pep requires mod_caps
  mod_roster: {}
  mod_shared_roster: {}
  mod_stats: {}
  mod_time: {}
  mod_vcard:
    search: false
  mod_version: {}



allow_contrib_modules: true

【问题讨论】:

  • 你能同时检查epmd -names吗?此外,杀死 epmd 并使用 epmd -depmd -d -d -d(提高调试级别)进入调试模式可能会帮助您发现问题。
  • 这是我从 epmd -names 得到的: epmd:在端口 4369 上启动并运行数据:在端口 41198 上命名 ejabberd
  • 请在这两个上。 epmd 是一个单独运行在每个节点上的守护进程,它负责建立和维护节点之间的连接。看起来 node1 接受了来自 node2 的请求,所以还需要查看另一个节点上发生了什么。
  • 这可能是 epmd 收到请求但没有从 ejabberd 获得响应的情况吗?什么是调试这个的好方法?
  • 节点名/cookie 似乎设置不正确。因为两个节点都返回 nonode@nohost/nocookie。正确设置节点名并且两个节点共享相同的 cookie 很重要

标签: amazon-web-services erlang ejabberd


【解决方案1】:

您似乎缺少 ejabberdctl.cfg 中的配置更改 ejabberdctl.cfg 文件中的以下行-

#INET_DIST_INTERFACE=127.0.0.1 to 

INET_DIST_INTERFACE=104.10.120.122 (whatever your host public ip)

并打开 erlang 控制台并运行以下命令-

net_adm:ping('ejabberd@ejabberd1'). # your node

如果它现在返回 pong,您可以在 ejabberd 节点之间进行集群。 运行以下命令来制作集群- ejabberdctl join_cluster 'ejabberd@ejabberd1'

【讨论】:

    【解决方案2】:

    我在 EC2 上设置 Ejabberd 集群时遇到了同样的问题。这里的解决方案供参考。

    确保在内部/私有网络上打开以下端口

    • 5222 - xmpp 客户端连接
    • 5280 - 门户网站
    • 4369 - EPMD
    • 5269 - S2S
    • 4200-4210节点通信
    • 还允许内部 ping(icmp 数据包)以防万一。

    接下来在 ejabberdctl.cfg 文件中设置 FIREWALL_WINDOW 选项,如下所示。这将设置 Erlang 使用定义的端口范围而不是动态的 用于节点通信的端口。 (参考 ejabberdctl.cfg)

    FIREWALL_WINDOW=4200-4210

    并为您的 Ejabberd 节点使用完整的节点名称,例如:ejabberd@srv1.example.com

    【讨论】:

      【解决方案3】:

      首先,@Uday Sawant 的方法是强制性的。

      您还应该将每个节点信息添加到 /etc/hosts

      例如,如果您的节点是

      ejabberd@node1
      ejabberd@node2
      

      将这些设置为两个系统的主机文件。

      1. 对于操作系统,

        添加您的 ejabbered 节点主机名

        vi /etc/hosts
        ...
        node1    10.0.100.1
        node2    10.0.100.2
        
      2. 对于二郎

        vi $HOME/.hosts.erlang
        'node1'.
        'node2'.
        

      host file for ejabberd

      【讨论】:

        猜你喜欢
        • 2015-11-01
        • 1970-01-01
        • 2011-09-01
        • 2017-09-20
        • 1970-01-01
        • 1970-01-01
        • 2019-04-10
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多