为了可扩展性,我希望 Map actor 实例(mapActor
如下命名)分布在多个远程节点上,比如host1
,host2
和host3
. 我不确定如何在 Akka 中做到这一点, application.conf
例如
MapReduceSystem {
include "common"
akka {
actor {
deployment {
/mapActor {
router = round-robin
nr-of-instances = 48
remote = "akka.tcp://MapReduceSystem@host1:2552,akka.tcp://MapReduceSystem@host2:2552,akka.tcp://MapReduceSystem@host3:2552"
}
/reduceActor {
remote = "akka.tcp://MapReduceSystem@host1:2552"
router = round-robin
nr-of-instances = 1
}
/masterActor {
remote = "akka.tcp://MapReduceSystem@host1:2552"
nr-of-instances = 1
}
}
}
remote.enabled-transports = ["akka.remote.netty.tcp"]
remote.netty.tcp.hostname = "host1"
}
}
为了完整起见,这是我的common.conf
:
akka {
actor {
provider = "akka.remote.RemoteActorRefProvider"
}
remote.netty.tcp.port = 0
remote.log-remote-lifecycle-events = off
loggers = ["akka.event.slf4j.Slf4jLogger"]
loglevel = "DEBUG"
}
请注意mapActor
我想提供 3 个主机来创建此 Actor 的实例的定义,每个实例 16 个,但remote
参数只接受一个主机。我怎样才能做到这一点?
据我了解,此配置将对应于系统启动机器,配置在andhost1
上看起来如何?host2
host3