[ejabberd] Distributed jabber nodes

Alexey Shchepin alexey at sevcom.net
Thu Aug 5 15:20:28 MSD 2004


Hi!

 AS> http://lists.jabber.ru/pipermail/ejabberd/2004-April/000102.html

Ouch, mailman replaced "@" with "_at_" on this page, I'll better
repost it here:

Suppose you already setup ejabberd on one of these machines ('first').
Then do following steps:

1. On another machine ('second') copy ~ejabberd/.erlang.cookie file
from 'first'.

1(alt). You can also add "-cookie big_secret_from_.erlang.cookie"
option to all "erl" commands below.


2. On 'second' run the following command in directory where ejabberd
will work later and under 'ejabberd' user:

erl -sname ejabberd \
    -mnesia extra_db_nodes "['ejabberd at first']" \
    -s mnesia

This will start mnesia serving same DB as ejabberd at first.  You can
check this running "mnesia:info()." command.  You should see a lot of
remote tables and line like the following:

running db nodes   = [ejabberd at first, ejabberd at second]


3. Now run this inside the same "erl" session:

mnesia:change_table_copy_type(schema, node(), disc_copies).

This will create local disc storage for DB.

3(alt). Login with Tkabber on 'first', and choose Discovery -> running
nodes -> ejabberd at second -> DB -> ejabberd:config.  Change 'scheme'
storage type to "RAM and disc copy".


4. Now you can add replicas of various tables to this node with
"mnesia:add_table_copy" or "mnesia:change_table_copy_type" as above
(just replace "schema" with another table name and "disc_copies" can
be replaced with "ram_copies" or "disc_only_copies").

What tables to replicate is very depend on your needs, you can get
some hints from "mnesia:info()." command, by looking at size of tables
and default storage type for each table on 'first'.

Replicating of table makes lookup in this table faster on this node,
but writing will be slower.  And of course if machine with one
replicas is down, other replicas will be used.

Also section "5.3 Table Fragmentation" here[1] can be useful.

4(alt). Same as in 3(alt), but for other tables.

[1] http://erlang.org/doc/r9c/lib/mnesia-4.1.4/doc/html/part_frame.html


5. Run "init:stop()." or just "q()." to exit from erl shell.  This
proably can take some time if mnesia is not yet transfer and process
all data it needed from 'first'.


6. Now run ejabberd on 'second' with almost the same config as in
'first' (you probably don't need to duplicate "acl" and "access"
options -- they will be taken from 'first', and mod_muc and mod_irc
should be enabled only on one machine in cluster).

You can repeat these steps for other machines supposed to serve this
domain.


More information about the ejabberd mailing list