ejabberd聚类,当主机掉线时Slave不起作用 [英] ejabberd clustering, Slave doesn't work when master goes down

查看:155
本文介绍了ejabberd聚类,当主机掉线时Slave不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经设置了ejabberd聚类,一个是master,另一个是slave,如这里



我已将.erlang.cookie和数据库文件从主服务器复制到从服务器。
一切正常。

问题是当我停止主节点时:


  1. 然后没有请求

  2. 尝试重新启动从属节点时,它不会启动。



我被困在这里,请帮助我。
谢谢

解决方案

这是Mnesia的标准行为。如果您启动的节点不是最后一个在群集中停止的节点,那么它没有任何方法可以知道它是否具有最新的,最新的数据。



启动Mnesia群集的过程是以关闭节点的相反顺序启动节点。



如果最后一次在Mnesia群集中看到的节点无法启动或加入群集,则需要使用Mnesia命令来强制群集master,这就是告诉您您认为此节点具有最新的内容。这可以通过使用Erlang命令 mnesia:set_master_nodes / 1 完成。例如,从ejabberd Erlang命令行:



$ b

mnesia :set_master_nodes([节点1 @为myhost])。

在大多数情况下,Mnesia集群会自动处理所有内容。当节点断开时,其他节点意识到并自动继续工作。您需要将哪个节点设置为参考数据(使用 set_master_nodes / 1 )的唯一情况是,对于Mnesia来说,这是不明确的,即只启动节点当还有运行节点或者有一个netsplit的时候,它就会关闭。


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

解决方案

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.

这篇关于ejabberd聚类,当主机掉线时Slave不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆