[ejabberd] Clustering question...

Michael Weibel michael.weibel at gmail.com
Tue May 8 10:55:16 MSK 2012


Hi Felix,

First, full disclosure: The project I'm working on and which will massively use ejabberd is not live yet, so I'm not production proven yet.

> It does seem to work when I take off the extra_db_nodes parameter from the start up script. So that parameter is just for setting up replication, you say? Interesting...!
> 
> However, the official guide and the one I linked to mention to add this parameter to the second (or extra) node only. In my case, it seems the clustering was not proper until I also added the parameter to the first/original node. But you are right that once the clustering is set up, then it seems possible to take off that parameter and things still work (with the expected fault-tolerance and all)...!
> 
> In your experiments, did you (initially) add that parameter to all nodes, or were you able to get things working correctly by adding it to the second node only? I'm wondering if I'm coming to the right conclusions, or if something else is going on in my environment that would have caused the behavior I observed...!

Basicly as we setup the clustering in our test environment we did it more or less this way:

- Modify ejabberdctl.cfg to have the correct ERLANG_NODE setting (both nodes)
- Copy .ejabberd.cookie from first node to second node
- Stop ejabberd on first node 
- erl -sname SECOND_ERLANG_NODE -mnesia extra_db_nodes "['FIRST_ERLANG_NODE']" -mnesia dir '"var/lib/ejabberd/"' 
- mnesia:change_table_copy_type(schema, node(), disc_copies).
- q().
- start ejabberd on first node again
- go to webinterface of first node and you should see the second node
- go to webinterface of second node and change all mnesia table copy types to match the ones from first node (you can do that from the cli as well but on the webinterface it's much easier to do for only a few nodes)

This should work without specifying extra_db_nodes at all after the first setup.

Basicly I have been told that clustering in erlang is done solely by replicating the mnesia tables. Everything else works out of the box due to built-in clustering in erlang. 

> Regarding your other comment: I am surprised that you say the configuration of Mnesia should be the same on both/all nodes, because that would imply that Remote copies are never ok. Is that what you mean?

I'm not yet at the point to say that for sure. But anyway if you need to scale, you should use mnesia as less as possible (better use PostgreSQL/MySQL)..

> 
> I'm definitely looking forward to reading your blog posts on the subject! Do post them here once you write them, please :) !

Of course I will do that :)

- Michael



More information about the ejabberd mailing list