[ejabberd] ejabberd clustering and SLB questions

Badlop badlop at gmail.com
Mon Sep 21 12:25:00 MSD 2009

2009/9/17 Jan Koum <jan.koum at gmail.com>:
> lets say that i will get two servers, im1.example.com and
> im2.example.com and jabber domain of im.example.com (let's call old jabber
> domain old-im.example.com)

Just to be sure we speak about the same, I extend a little more what I
understood from your

You now have in the machine im1.example.com an ejabberd serving the
domain old-im.example.com
This means you configured in ejabberd.cfg:
  {hosts, ["old-im.example.com"]}.

You plan to install ejabberd also in im2.example.com, and those two
ejabberd deployments will cooperate to serve the same domain (which
you plan it to be im.example.com).
This means you configure in ejabberd.cfg of both machines:
  {hosts, ["im.example.com"]}.
Then you follow the steps described in the guide to setup the Mnesia
database replication (copy erlang cookie file, tell Mnesia of second
node the machine name of first node...)

> 1. if i cluster im1 and im2 nodes, will users registered on either one be
> automatically replicated into the other, or should i always register on im1
> and it will sync mnesia db into im2?

When you configure Mnesia of both nodes, you decide what tables to
replicate between both nodes,
which later will be automatically synchonized.
If you use internal auth, remember to setup the table 'passwd' as replicas.
Probably also tables 'roster', 'offline_msg' and 'vcard'.

> 2. how does the "client connecting to server" fail over occurs?  right now
> my users connect into old-im.example.com hostname (which is also the name of
> jabber domain).  if i switch to using im1 and im2, will i need to modify
> xmpp client to first connect to im1.example.com and if it is down, connect
> to im2.example.com or for the sake of distributing the load, should client
> randomly pick between im1 and im2 and try the other one if first one fails
> to connect?

This is at your decision, because it is client's duty to select to
which IP address to connect, in any way you want. Each ejabberd node
will just take care to serve the TCP connections it directly receives.

Remember that ejabberd clustering support, as described in the Guide,
only takes care about synchronizing the content of the tables of
Mnesia database that you decided.

Other tasks like selecting which node to connect to, reconnect to the
node if it's restarted,
try to connect to the other node if my previous one seems down...
all this is to be implemented outside ejabberd.

> 3. if i cluster im1 and im2 together for the jabber domain of
> im.example.com, how do migrate data from the an old server that i have now?

> has accounts
> all of my current users are registered as nickname at old-im.example.com --
> should i simply keep old-im.example.com domain and use new im1 and im2
> servers/nodes with the old jabber domain name?

It is a lot easier to continue using the same domain name.
In your new ejabberd deployment you can setup:
  {hosts, ["old-im.example.com"]}.
Then follow the Guide to replicate most tables of im1's database into
im2's database.

On the other hand, if you want to 'rename' the domain name, you have a
lot of work to do.
Your old database contains many roster items which refer to the domain
You would need to manipulate the database content to replace
references to old domain name to the new domain name.
Furthermore, if your users have contacts in other remote Jabber
servers, those remote Jabber servers
also refer to the old domain, and they would become obsolete if you
change the domain name.

> and also, while i understood clustering setup (Chapter 6.2), i was a little
> bit unclear on SLB setup (Chapter 6.3) -- what are the components which the
> document refers to and how can i use SLB to provide high availabilty?  seems
> like that is what clustering itself is for, right?

Section 6.2 is about clustering the Jabber server (ejabberd in this case).
Section 6.3 is about clustering Jabber services (like
gateways/transports to non-XMPP networks).

> thanks, i appreciate any feedback i can get from the experts.

Disclaimer: I am not expert in ejabberd clustering or in general clustering.
This is what I know. If you have more questions/problems, ask an expert :)


More information about the ejabberd mailing list