3
votes

Hi I have been trying to set up an ejabberd cluster. However on trying to join from node2 to node1 , i get an error saying

On node 2:

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

I can clearly ping node1 from node2.

Both the node are hosted in the same region on AWS. I have tried allowing all traffic on node 1. Both have the same .erlang.cookie.

Not sure why i continue to get that error.

# 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        

ejabberdctl.cfg on node1 :

ERLANG_NODE=ejabberd@<internal IP of node1>

ejabberd.yml on node1:

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
3
Can you check epmd -names on both? Also, killing epmd and starting in debug mode with epmd -d or epmd -d -d -d (increasing debug level) may help you discover issues.Greg
This is what i get for epmd -names : epmd: up and running on port 4369 with data: name ejabberd at port 41198Madhavan Malolan
On both please. epmd is a daemon running on each node separately and it is responsible for establishing and maintaining connections between nodes. It looks like node1 accepts the request from node2 so need to see what's happening on the other node too.Greg
Could this be a case of epmd recieving the request, but is is not getting a response from ejabberd? What is a good way to debug this?Madhavan Malolan
The nodenames/cookies seem to not be set correctly. since both nodes return nonode@nohost/nocookie. It is important that nodenames are set correctly and that both nodes share the same cookieP. Kathmann

3 Answers

2
votes

I faced the same issue while setting up Ejabberd cluster on EC2. Here solution for reference.

Make sure following ports are open on internal/private network

  • 5222 - xmpp client connection
  • 5280 - web portal
  • 4369 - EPMD
  • 5269 - S2S
  • 4200 - 4210 node communication
  • Also allow internal ping (icmp packets) just in case.

Next set FIREWALL_WINDOW option in ejabberdctl.cfg file as follows. This will set Erlang use a defined range of port instead of dynamic ports for node communication. (refer ejabberdctl.cfg)

FIREWALL_WINDOW=4200-4210

And use full node names for you Ejabberd nodes eg: [email protected]

0
votes

it seems you are missing configration in ejabberdctl.cfg change the following line in your ejabberdctl.cfg file-

#INET_DIST_INTERFACE=127.0.0.1 to 

INET_DIST_INTERFACE=104.10.120.122 (whatever your host public ip)

and open erlang console and run the following command-

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

if it will return pong now you can do cluster between ejabberd nodes. run the following command to make cluster- ejabberdctl join_cluster 'ejabberd@ejabberd1'

0
votes

Frist, @Uday Sawant's method is mandatory.

and also you should add each node info into /etc/hosts

for example, if your nodes are

ejabberd@node1
ejabberd@node2

set these to host file for two systems.

  1. for os,

    add your ejabbered node hostname

    vi /etc/hosts
    ...
    node1    10.0.100.1
    node2    10.0.100.2
    
  2. for erlang

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

host file for ejabberd