Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/reporting-services/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
谷歌云虚拟机上的Akka远程处理_Akka_Google Cloud Platform_Akka Remote Actor - Fatal编程技术网

谷歌云虚拟机上的Akka远程处理

谷歌云虚拟机上的Akka远程处理,akka,google-cloud-platform,akka-remote-actor,Akka,Google Cloud Platform,Akka Remote Actor,我是Akka的新手,我正在尝试在Google云VM实例上运行一个在localhost上工作的简单远程处理actor VM既有内部IP,也有外部IP。当我启动一个IP设置为external的actor时,它无法启动 但是当我这么做的时候 netty.tcp { hostname = "<internal IP>" port = 45000 netty.tcp{ hostname=“” 端口=45000 一切开始都很好 现在很明显,当尝试从另一台机器连接时,内部IP无法解析,

我是Akka的新手,我正在尝试在Google云VM实例上运行一个在localhost上工作的简单远程处理actor

VM既有内部IP,也有外部IP。当我启动一个IP设置为external的actor时,它无法启动

但是当我这么做的时候

netty.tcp {
  hostname = "<internal IP>"
  port = 45000
netty.tcp{
hostname=“”
端口=45000
一切开始都很好

现在很明显,当尝试从另一台机器连接时,内部IP无法解析,因此我尝试使用以下命令查找参与者:

context.actorSelection("akka.tcp://Main@<external IP>:45000/user/app")
context.actorSelection(“akka。tcp://Main@:45000/用户/应用程序)
并获取以下错误:

[错误]正在删除非本地收件人[actor[akka.actor.ActorSelectMessage]的邮件[class akka.actor.ActorSelectMessage]。tcp://Main@外部IP:45000/]]到达[阿克卡。tcp://Main@外部IP:45000]入站地址为[akka]。tcp://Main@内部IP:45000]

最后一部分是有道理的,但是我如何使整个过程正常运行呢?

找到了解决方案

它基于即将发布的2.4版本中提供的
bind hostname
config设置:

构建.sbt

resolvers += "Typesafe Snapshots" at "http://repo.akka.io/snapshots/"

libraryDependencies ++= Seq(
  "com.typesafe.akka" %% "akka-actor" % "2.4-SNAPSHOT",
  "com.typesafe.akka" %% "akka-remote" % "2.4-SNAPSHOT"
)
application.conf

akka {
  actor {
    provider = "akka.remote.RemoteActorRefProvider"
  }
  remote {
    enabled-transports = ["akka.remote.netty.tcp"]
    netty.tcp {
      hostname = "external IP"
      port = 45000
      bind-hostname = "internal IP"
    }
 }
}
如果需要,您还可以指定
bind port