Cluster ejabberd

本文档详细介绍了如何使用Ejabberd在两台机器上建立一个XMPP集群的过程。主要内容包括设置服务器名称、确定节点名称、配置相同的Erlang cookie、连接不同节点以及最后的集群测试步骤。

2007-12-4

 

Cluster ejabberd

for example, we want to do a cluster for two machines.

1. Ejabberd server name
we must have one name of ejabberd server, Fox example “cluster.com”

diagram1


2. Node name
we need to know what is the node name.
For example, this node name is
ejabberd@li_chao_PC
remark : node name can't be changed after installation. In general, node name is same as machine name.

diagram2
3. Erlang cookie
Shutdown the two machines, and  make sure the content of file /root/.erlang.cookie are same between two machines. Of cause, you can modify it, for example, change the content to “BYJY”
vim /root/.erlang.cookie
BYJY
so, the first machine's erlang cookie is “BYJY” and the second machines's erlang cookie is “BYJY” too.

 

4. Connect nodes
Start ejabberd at one machine. For example :
one node name is
“ejabberd@li_chao_PC
another node name is
“ejabberd@wei-jun

we assume you start node “ejabberd@li_chao_PC”, start node mean start ejabberd.
You want to connect node
“ejabberd@wei-jun”, then enter below command :
erl -sname ejabberd -mnesia extra_db_nodes “['ejabberd@wei-jun']” -s mnesia

you will see the below information
running db nodes = [ejabberd@wei-jun,
ejabberd@li_chao_PC ]
if you don't see the information above then mean failure.
Now run the following command in the same 'erl' session:
mnesia:change_table_copy_type(schema, node(), disc_copies).

Run below command to exit from the Erlang shell.
Init:stop().

Restart node ejabberd@li_chao_PC, finished.

diagram3
5. Test cluster
open the administarte webiste

diagram4
if the two machine's ip is
10.135.192.7
10.135.192.37

you can modify file /etc/hosts in the others machine.
10.135.192.7 cluster.com
or
10.135.192.37 cluster.com

that's ok!
There are two machine named “cluster.com” , you can use XMPP client to connect any one which you like to.

Of cause, you'd better configure DNS to accomplish load balance.

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值