gpt4 book ai didi

java - 如何处理 master actor 故障

转载 作者:可可西里 更新时间:2023-11-01 15:36:11 25 4
gpt4 key购买 nike

我是 Akka 的新手,我构建了一个连接到 HDFS 的 Akka 模型,提取数据,对其进行处理并将处理后的数据写回 HDFS。现在,如果我的 master actor 崩溃了,那么相应的子 actor (Workers) 也会崩溃,整个系统必须重新启动。

因此,如果有一个创建辅助主控的进程,一旦主主控发生故障且恢复时间最短,它会自动开始运行。我无法围绕这个画出清晰的画面。

我们将不胜感激。

谢谢

最佳答案

来自docs :

/user: The Guardian Actor

The actor which is probably most interacted with is the parent of all user-created actors, the guardian named "/user". Actors created using system.actorOf() are children of this actor. This means that when this guardian terminates, all normal actors in the system will be shutdown, too. It also means that this guardian’s supervisor strategy determines how the top-level normal actors are supervised. Since Akka 2.1 it is possible to configure this using the setting akka.actor.guardian-supervisor-strategy, which takes the fully-qualified class-name of a SupervisorStrategyConfigurator. When the guardian escalates a failure, the root guardian’s response will be to terminate the guardian, which in effect will shut down the whole actor system.

您的主人是您应用程序中的顶级参与者,因此他是用户监护人的 child ,因此他将自动重启,因为监护人的监督默认为:

  final val defaultDecider: Decider = {
case _: ActorInitializationException ⇒ Stop
case _: ActorKilledException ⇒ Stop
case _: DeathPactException ⇒ Stop
case _: Exception ⇒ Restart
}

关于java - 如何处理 master actor 故障,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25056195/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com