云中 ejabberd 集群的一致部署?

Consistent deployment for ejabberd cluster in cloud?

来自文档 @ http://docs.ejabberd.im/admin/guide/clustering/#clustering-setup

Adding a node into the cluster is done by starting a new ejabberd node within the same network, and running a command from a cluster node. On second node for example, as ejabberd is already started, run the following command as the ejabberd daemon user, using the ejabberdctl script: ejabberdctl join_cluster 'ejabberd@first'

这如何转化为云中的部署 - 其中实例可以(希望)shutdown/restarted 基于一致的图像并位于负载均衡器之后?

所有这些,包括初始实例,都可以在上面的示例中使用 "example.com" 作为 "first"(假设 "example.com" 在 DNS 中设置为指向云负载平衡器) ?

或者第一个实例必须不尝试加入集群,并且后续实例都使用该初始实例的 IP 地址而不是 "first"(如果是这种情况 - 如果那样会变得古怪吗初始实例宕机)?

Can all of them, including the initial instance, use "example.com" as "first" in the example above (assuming "example.com" is setup in DNS to point to the cloud load balancer)?

不是,节点名参数是Erlang ejabberd节点的节点名。它更应该在亚马逊内部网络上,而不是 public 网络上,因此它不应该依赖中央 DNS。它必须是 Erlang 节点的名称,作为新启动的节点连接到现有节点以共享相同的 "cluster schema" 并进行数据的初始同步。

所以,部署完成如下:

  • 第一个实例确实不需要加入集群,因为没有要共享的集群架构。
  • 新实例可以使用集群中任何其他节点的节点名。这意味着他们会将自己添加到 ejabberd 集群模式中。这意味着 ejabberd 知道用户可以在这个集群的任何节点上。您可以指向集群中的任何 运行 个节点来添加一个新节点,因为它们都是等效的(没有主节点)。
  • 您仍然需要配置负载平衡器以平衡所有节点上 public XMPP 端口的流量。

您只需为每个额外的集群节点执行一次集群配置。所有节点的配置都保存在本地,因此当您停止并重新启动一个节点时,它会在正确设置后自动重新加入集群。