重新启动所有关闭的后端节点后,akka前端节点如何连接到集群?

重新启动所有关闭的后端节点后,akka前端节点如何连接到集群?,akka,cluster-computing,frontend,backend,seed,Akka,Cluster Computing,Frontend,Backend,Seed,以官方为例进行演示: 1.首先,启动前端节点 sbt 'runMain sample.cluster.factorial.FactorialFrontendMain' 二,。启动两个后端节点,它们也是单独的种子节点 sbt 'runMain sample.cluster.factorial.FactorialBackendMain 2551' sbt 'runMain sample.cluster.factorial.FactorialBackendMain 2551' 现在一切都应该很好

以官方为例进行演示:
1.首先,启动前端节点

sbt 'runMain sample.cluster.factorial.FactorialFrontendMain'
二,。启动两个后端节点,它们也是单独的种子节点

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)并再次重新启动它们时,任一后端节点的状态始终为“加入”,并且不能更改为“启动”


前端节点如何在不重新启动前端节点的情况下自动加入种子节点?它在重新启动前端节点时工作

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

如果要在本例中重新启动“后端”节点,并让它们加入已在运行的“前端”节点,则“后端”节点必须启动与“前端”节点的连接,反之亦然。换句话说,“前端”节点随后充当这些新启动的后端节点的种子节点

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

如果您做出调整使之成为可能,请记住,本例使用“自动向下”作为向下策略。这意味着当集群领头节点暂时无法到达某个节点时,它会将该节点标记为(永久性地)“向下”。即使当节点返回时,它也不能再以其原始地址加入集群,而原始地址现在被永久禁止加入集群(以防止某些未定义的行为和“大脑分裂”问题)


注意,在生产中,您可能不会使用自动装订,而是运行一个工具,它可以从外部查看您的节点,并决定哪些节点只考虑“不可达”,哪些永久性退役。

[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]