Search code examples
ejabberd

ejabberd-16.09 clustering and namenode issue


I am working as root and using centos7. I have installed ejabberd 16.09 in two different machines using RPM package. In both the cases I have the same nodename (ejabberd@localhost) and same host (ejabberd.c.southern-silo-174209.internal) since I cloned the disk of the first machine into the second. Everything is working fine.

Trouble arises when I want to cluster these machines. Since the disks are clones I have the exact copies of .erlang.cookie and ejabberd.yml in both the machines (I verified the contents personally). Now when I execute this command, on either of the machines, ejabberdctl join_cluster "ejabberd@localhost" I get an error saying : {not_master,ejabberd@localhost}. This seemed natural as how can the cluster be formed when I am having two same nodenames.

To overcome this problem I freshly installed ejabberd in my second machine. But to my surprise it again gives me the same nodename!!(ejabberd@localhost) So to achieve clustering, the natural thing would be to change the nodenames. Ok lets try it!!

Following these steps ejabberd change nodename guide

I was able to follow till step 3.

[OLDNODE=ejabberd@localhost and NEWNODE=ejabberd@myfirstmachine where myfirstmachine is the hostname of my computer]

For step 4, I coudnt find any /var/lib/ejabberd directory in my system(probably because I didnt create user ejabberd). Instead I found this directory called "ejabberd@localhost" inside /opt/ejabberd-16.09/database which contained all the .DAT, .DCD and .DCL files. So I created a folder /opt/ejabberd-16.09/database/oldfiles and migrated all the files from ejabberd@localhost directory to this directory.

Following on everything went fine till step 6. When I execute step 7 I get the following error.

Can't install fallback from "/tmp/new.backup" at node ejabberd@localhost: {"Cannot install fallback", {"No disc resident schema on local node", [ejabberd@myfirstmachine]}}

So here I am stuck. I just want to attain clustering of different machines. I have no interest in namenode. I even tried another technique and that was to add ERLANG_NODE in ejabberdctl.cfg but after adding I am unable to access the web admin.


Solution

  • If you don't want any older data from any of node then you can follow below steps for clustering.

    1. Stop All nodes
    2. Remove everything from opt/ejabberd-16.09/database directory in all three nodes using rm-rf opt/ejabberd-16.09/database
    3. Change ERLANG_NODE in all three node as per 'ejabberd@hostname' where hostname should be routable
    4. Restart all node
    5. Now join cluster from node 1 to node 2 using ejabberdctl join_cluster 'ejabberd@node2'
    6. After that go to node 3 and use same command as above ejabberdctl join_cluster 'ejabberd@node2'
    7. Your cluster should be setup now.It can be checked by ejabberdctl list_cluster