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!
[...] J’ai pu tester un clustering basique de cette nouvelle version sur Amazon Ec2 avec un Ubuntu Karmic 64 bits, la démarche a été nettement simplifiée. Il suffit de suivre le process d’installation avec le node par défaut ejabberd@’hostname -f’, de copier le fichier .erlang.cookie dans le répertoire $home des serveurs du cluster, et de synchroniser les bases Mnesia en suivant les étapes 4 à 10 de ce tuto. [...]
What does “Edit sbin/ejabberdctl to have $ERLANG_NODE at the end” mean?
hmm, good question :) back then i recall that ejabberdctl did not respect the setting you made regarding your nodename in ejabberdctl.cfg so i had to change some line.
looking at the current svn it still seems that you have to set the nodename twice, in ejabberdctl.cfg at the end and then in the first few lines of ejabberdctl itself. i think i did something to read the configfile earlier or something. if things work for you you can simply disregard that line.