ejabberd clustering, Slave doesn't work when master goes down

爷,独闯天下 提交于 2019-12-01 05:20:48

问题


I have setup ejabberd clustering, one is master and other is slave as described here.

I have copied .erlang.cookie and database files from master to slave. Everything is working fine.
The issue is when I stop master node:

  1. Then no request getting routed to slave.
  2. When trying to restart slave node its not getting start once it down.

I get stuck here, please help me out. Thanks


回答1:


This is the standard behaviour of Mnesia. If the node you start was not the last one that was stopped in a cluster, then it does not have any way to know if it has the latest, most up to date data.

The process to start a Mnesia cluster is to start the node in reverse order in which they were shutdown.

In case the node that was last seen on Mnesia cluster cannot start or join the cluster, them you need to use a Mnesia command to force the cluster "master", that is tell it that you consider this node has the most up to date content. This is done by using Erlang command mnesia:set_master_nodes/1.

For example, from ejabberd Erlang command-line:

mnesia:set_master_nodes([node1@myhost]).

In most case, Mnesia clustering handles everything automatically. When a node goes down, the other nodes are aware and automatically keep on working transparently. The only case you need to set which node as the reference data (with set_master_nodes/1), is when this is ambiguous for Mnesia, that is either when starting only nodes that were down when there was still running nodes or when there is a netsplit.




回答2:


Follow the step from below link: http://chadillac.tumblr.com/post/35967173942/easy-ejabberd-clustering-guide-mnesia-mysql and call the method join_as_master(NodeName) of the easy_cluster module.



来源:https://stackoverflow.com/questions/34715119/ejabberd-clustering-slave-doesnt-work-when-master-goes-down

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!