对于可伸缩性,我希望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
参数只需要一个主机。我怎么能这样做?
根据我的理解,此配置将对应于系统启动计算机host1
,配置在host2
和host3
上的外观如何?
答案 0 :(得分:2)
akka {
actor {
deployment {
/serviceA/aggregation {
router = "round-robin"
nr-of-instances = 10
target {
nodes = ["akka.tcp://app@10.0.0.2:2552", "akka.tcp://app@10.0.0.3:2552"]
}
}
}
}
}
因此,您需要remote = "a,b,c"
target.nodes = ["a","b","c"]
答案 1 :(得分:2)
除了pushy指出的配置语法问题之外,除了host1
之前host2
和host1
启动系统之外,您无需执行任何操作,以便/user/mapActor
时{} 1}}启动它的路由可以成功部署到它们上面。配置取自host1
并传输到其他主机,无需进一步配置,并且不需要在工作主机上调用actorOf
(至少不对所讨论的路由器进行调用) )。