easy ejabberd clustering guide (mnesia, mysql, & postgres)

原创文章,转载请注明: 转载自慢慢的回味

本文链接地址: easy ejabberd clustering guide (mnesia, mysql, & postgres)

Modified with easy-ejabberd-clustering-guide-mnesia-mysql

first things first, let’s configure our master node

(we’re assuming at this point you’ve installed ejabberd from source without a prefix, have it properly configured, and can successfully connect and message using it)


1: shut down your “master node”

ejabberdctl stop

2: edit ejabberdctl.cfg (/etc/ejabberd/ejabberctl.cfg)

2.1: change node name:

ERLANG_NODE=ejabberd@'master.domain.com'

2.2: change ip we listen on: (get this from ifconfig)

note: look closely, that’s a tuple, don’t use .’s use ,’s

INET_DIST_INTERFACE={192,168,10,100}

3: clear your ejabberd mnesia tables after hostname change

note: hostname changes are a pain, it’s easier to just let ejabberd rebuild the mnesia db’s at startup.

rm /var/lib/ejabberd/*

4: add hostname to /etc/hosts using address and hostname from confg

192.168.10.100    master.domain.com
192.168.10.100    xmppDomain

5: edit ejabberd.yml (/etc/ejabberd/ejabberd.yml)

###   ================
###   SERVED HOSTNAMES
##
## hosts: Domains served by ejabberd.
## You can define one or several, for example:
## hosts:
##   - "example.net"
##   - "example.com"
##   - "example.org"
##
hosts:
  - "xmppDomain"

6: start master node, and make sure it’s running

ejabberdctl start
ejabberdctl status

now we’ll need to configure our slaves

(once again we’re assuming the server is properly installed and functional as a stand alone server)


1: if the server is running, stop it.

ejabberdctl stop

2: update ejabberctl.cfg (/etc/ejabberd/ejabberdctl.cfg

2.1: change node name:

ERLANG_NODE=ejabberd@'slave1.domain.com'

2.2: change ip we listen on: (get this from ifconfig)

note: look closely, that’s a tuple, don’t use .’s use ,’s

INET_DIST_INTERFACE={192,168,10,150}

3: clear your ejabberd mnesia tables after hostname change

note: hostname changes are a pain, it’s easier to just let ejabberd rebuild the mnesia db’s at startup.

rm /var/lib/ejabberd/*

4: copy .erlang.cookie from “master node” (/var/lib/ejabberd/.erlang.cookie)

note: this is the unique cookie from ejabberd@master.domain.com, not the one already residing on slave1

5: add hostnames to /etc/hosts using address and hostname from confg

192.168.10.100    master.domain.com
192.168.10.100    xmppDomain
192.168.10.150    slave1.domain.com

6: edit ejabberd.yml (/etc/ejabberd/ejabberd.yml)

###   ================
###   SERVED HOSTNAMES
##
## hosts: Domains served by ejabberd.
## You can define one or several, for example:
## hosts:
##   - "example.net"
##   - "example.com"
##   - "example.org"
##
hosts:
  - "xmppDomain"

继续阅读“easy ejabberd clustering guide (mnesia, mysql, & postgres)”本作品采用知识共享署名 4.0 国际许可协议进行许可。