I found clustering in ejabberd not so easy if you go strictly by the manual
It does not really mention that Mnesia likes to create databases in the present working directory, and name them prefixed with Mnesia. This makes it hard to find out why two ejabberd nodes won’t connect to each others. Here is what we do:
- Configure and start ejabberd on “first”:
- Edit ejabberdctl.cfg to have your FULL nodename in the last line (ejabberd@first.example.com)
- Edit sbin/ejabberdctl to have the right nodename in NODE and HOST (lines 11 and 12)
- Edit sbin/ejabberdctl to have $ERLANG_NODE at the end
- sbin/ejabberdctl start
- Configure and start ejabberd on “second”:
- Edit ejabberdctl.cfg to have your FULL nodename in the last line (ejabberd@second.example.com)
- Edit sbin/ejabberdctl to have the right nodename in NODE and HOST (lines 11 and 12)
- Edit sbin/ejabberdctl to have $ERLANG_NODE at the end
- sbin/ejabberdctl start
- Stop ejabberd on “second”.
- Go to the database directory on “second” (i.e. /var/lib/ejabberd/db/)
- Delete or move away the directory that is named after your node (”ejabberd@second.example.com”)
- Start your remote erlang shell on “second”
erl -name ejabberd@second.example.com -mnesia extra_db_nodes "['ejabberd@first.example.com']" -s mnesia
(You should now see this node in the list of nodes in the web admin on “first.example.com”, not quite usable though. This tells you that the Mnesia connection itself is running fine.) - Syncronise databases
mnesia:change_table_copy_type(schema, node(), disc_copies).
- Quit Mnesia
q().
- Move the newly created directory (Mnesia.ejabberd@second.example.com) to the location of the directory that you deleted/moved before.
mv Mnesia.ejabberd@second.example.com ejabberd@second.example.com
- Start ejabberd on “second” (sbin/ejabberdctl start)
You should now see both nodes in the web admin interface at http://first.example.com:5280/admin and the cluster should be up and running fine. Now you can set up the rest of the database replication through the web interface. Works fine for us…
Tags: cluster, ejabberd, howto, mnesia
Author: steam
[...] Set up clustering in ejabberd (tags: xmpp jabber erlang cluster 247up sysadmin) [...]
What about clustering Mysql? is it possible with ejabberd ?
As with all the external “data backends” in ejabberd clustering will be left to the respective backend. So try mysql master-master-replication or something like that. Good luck!