ejabberd clustering

I used the excellent notes at the reference article. Here are additional notes for Debian:

  • There's no need to modify /usr/sbin/ejabberd or /usr/sbin/ejabberdctl; the only changes should be in /etc/ejabberd/ejabberd.cfg and /etc/default/ejabberd
  • I did "su ejabberd" instead of doing the testing under root (probably better, this way the database gets created with the proper userid). Also I only had to copy the .erlang.cookie file to /var/lib/ejabberd, no need to copy it under /root this way.
  • The proper command to start erl (at step 4 on the second server) is then:
    erl -sname ejabberd@jabber2 -mnesia dir \"$HOME\" \
        -mnesia extra_db_nodes "['ejabberd@jabber1']" \
        -s mnesia
    
    (assuming jabber1 and jabber2 are the servers' short names)
  • In /etc/default/ejabberd, the proper syntax is:
    ERL_OPTIONS="-mnesia extra_db_nodes ['ejabberd@jabber1'] -s mnesia"
    
    Extra double-quotes kept me busy for a while.

Also the primary server is the one where the web UI should be used; the other one(s) replicate the database.

Here's my complete /etc/default/ejabberd on jabber1:

SMP=auto
ERLANG_NODE=ejabberd

Here's my complete /etc/default/ejabberd on jabber2:

SMP=auto
ERL_OPTIONS=" -mnesia extra_db_nodes ['ejabberd@jabber1'] -s mnesia "
ERLANG_NODE=ejabberd

(If I get time I might rewrite this article into complete instructions using the reference article as a basis.)

posted: 2009-10-20 11:40

Written on October 20, 2009