【发布时间】:2014-07-17 17:10:59
【问题描述】:
我正在使用 Scala 中的 Akka Actor 构建一个库,以进行一些大规模的数据处理。
我正在使用 StarCluster 在 Amazon EC2 现货实例上运行我的代码。程序不稳定,因为演员远程处理有时会掉线:
在代码运行时,节点会在几分钟内一个接一个断开连接。节点会说:
[ERROR] [07/16/2014 17:40:06.837] [slave-akka.actor.default-dispatcher-4] [akka://slave/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2Fslave%40master%3A2552-0/endpointWriter] AssociationError [akka.tcp://slave@node005:2552] -> [akka.tcp://slave@master:2552]: Error [Association failed with [akka.tcp://slave@master:2552]] [
akka.remote.EndpointAssociationException: Association failed with [akka.tcp://slave@master:2552]
Caused by: akka.remote.transport.netty.NettyTransport$$anonfun$associate$1$$anon$2: Connection refused: master
和
[WARN] [07/16/2014 17:30:05.548] [slave-akka.actor.default-dispatcher-12] [Remoting] Tried to associate with unreachable remote address [akka.tcp://slave@master:2552]. Address is now quarantined, all messages to this address will be delivered to dead letters.
虽然我可以在节点之间 ping 通。
我一直在努力解决这个问题;我认为这是一些配置设置。 Akka 远程处理文档甚至说,
但是,在 Amazon EC2 等云环境中,该值可能是 增加到 12 以解决有时会出现的网络问题 发生在此类平台上。
但是,我已经设置了这一点,但仍然无法解决问题。以下是我当前的远程配置:
akka {
actor {
provider = "akka.remote.RemoteActorRefProvider"
}
remote {
enabled-transports = ["akka.remote.netty.tcp"]
netty.tcp {
port = 2552
# for modelling
#send-buffer-size = 50000000b
#receive-buffer-size = 50000000b
#maximum-frame-size = 25000000b
send-buffer-size = 5000000b
receive-buffer-size = 5000000b
maximum-frame-size = 2500000b
}
watch-failure-detector.threshold = 100
acceptable-heartbeat-pause = 20s
transport-failure-detector {
heartbeat-interval = 4 s
acceptable-heartbeat-pause = 20 s
}
}
log-dead-letters = off
}
我从主节点部署我的演员:
val o2m = system.actorOf(Props(classOf[IntOneToMany], p), name = "o2m")
val remote = Deploy(scope = RemoteScope(Address("akka.tcp", "slave", args(i), 2552)))
val b = system.actorOf(Props(classOf[IntBoss], o2m).withDeploy(remote), name = "boss_" + i)
etc.
谁能指出我正在犯的错误/如何解决这个问题并阻止节点断开连接?或者,如果演员断开连接,重新启动演员的一些解决方案也有效;我不太关心丢失的消息。事实上,我认为这应该是一种易于配置的行为,但我发现很难找到合适的位置来寻找它。
谢谢
【问题讨论】:
-
您是否已将安全组配置为允许端口 2552 上的传入连接?
-
不具体,但这些是 StarCluster 节点相互通信。演员们工作了一段时间,然后失败了。不可能是权限问题吧?
-
嗯...不,如果他们工作了一段时间然后失败了,这听起来不像是网络权限问题。您是否尝试过从受影响的节点远程登录到 master 的 2552 端口?只是逐层检查。
标签: scala amazon-ec2 akka akka-remote-actor