重启所有下行后端节点后,akka前端节点如何连接到群集?

时间:2017-05-11 11:01:03

标签: akka cluster-computing frontend backend seed

以官方示例akka-sample-cluster-java进行演示:
1.首先,启动前端节点

sbt 'runMain sample.cluster.factorial.FactorialFrontendMain'

2。启动后端节点,这些节点也分别是种子节点

sbt 'runMain sample.cluster.factorial.FactorialBackendMain 2551'
sbt 'runMain sample.cluster.factorial.FactorialBackendMain 2551'

现在一切都应该没问题。

[info] [INFO] [05/11/2017 17:40:42.822] [ClusterSystem-akka.actor.default-dispatcher-3] [akka.cluster.Cluster(akka://ClusterSystem)] Cluster Node 
[akka.tcp://ClusterSystem@127.0.0.1:2551] - Node 
[akka.tcp://ClusterSystem@127.0.0.1:2552] is JOINING, roles [backend]
[info] [INFO] [05/11/2017 17:40:43.349] [ClusterSystem-akka.actor.default-dispatcher-4] [akka.cluster.Cluster(akka://ClusterSystem)] Cluster Node 
[akka.tcp://ClusterSystem@127.0.0.1:2551] - Leader is moving node 
[akka.tcp://ClusterSystem@127.0.0.1:2551] to [Up]
[info] [INFO] [05/11/2017 17:40:43.349] [ClusterSystem-akka.actor.default-dispatcher-4] [akka.cluster.Cluster(akka://ClusterSystem)] Cluster Node 
[akka.tcp://ClusterSystem@127.0.0.1:2551] - Leader is moving node 
[akka.tcp://ClusterSystem@127.0.0.1:2552] to [Up]
[info] [INFO] [05/11/2017 17:40:43.349] [ClusterSystem-akka.actor.default-dispatcher-4] [akka.cluster.Cluster(akka://ClusterSystem)] Cluster Node     
[akka.tcp://ClusterSystem@127.0.0.1:2551] - Leader is moving node         
[akka.tcp://ClusterSystem@127.0.0.1:56431] to [Up]

但是,当我停止两个后端节点(通过ctrl + c)并再次重新启动它们时,后端节点的状态始终为“join”,并且不能更改为“up”。 / p>

[info] [INFO] [05/11/2017 17:39:32.356] [ClusterSystem-akka.actor.default-dispatcher-4] [akka.cluster.Cluster(akka://ClusterSystem)] Cluster Node [akka.tcp://ClusterSystem@127.0.0.1:2551] - Node [akka.tcp://ClusterSystem@127.0.0.1:2551] is JOINING, roles [backend]
[info] [INFO] [05/11/2017 17:39:35.637] [ClusterSystem-akka.actor.default-dispatcher-3] [akka.cluster.Cluster(akka://ClusterSystem)] Cluster Node 
[akka.tcp://ClusterSystem@127.0.0.1:2551] - Node 
[akka.tcp://ClusterSystem@127.0.0.1:56431] is JOINING, roles [frontend]

前端节点如何在不重启前端节点的情况下自动加入种子节点?它在重启前端节点时有效。

1 个答案:

答案 0 :(得分:0)

一旦形成集群,集群中的节点将停止寻找(其他)种子节点:种子节点仅用于集群的初始形成。

如果您想重新启动后端'在这个例子中的节点,让他们加入已经运行的前端'节点,然后是'后端'节点必须启动与前端的连接。节点,反之亦然。换句话说:'前端'然后,node充当这些新启动的后端节点的种子节点。

在此示例中,这有点棘手,因为前端'节点没有侦听可预测的端口号。

如果您进行了调整以使其成为可能,请记住此示例使用'自动缩减'作为一种打击策略。这意味着当群集领导者暂时无法访问某个节点时,它会将该节点标记为(永久)' down'。即使节点返回,它也不能再使用其原始地址加入群集,现在该群集已永久禁止群集(以防止某些未定义的行为和“大脑问题”)。

请注意,在制作中,您可能不会使用自动缩减功能,但运行的工具可以从外部查看您的节点'并决定仅考虑哪些节点“无法访问”#39;哪个是永久性退役。

相关问题