【发布时间】:2018-11-20 12:14:28
【问题描述】:
我是 akka 的新手,想使用 akka 远程连接两台 PC,只是为了在两者中运行一些代码(2 个参与者)。我已经尝试过akka doc 中的示例。但我真正要做的是将 2 个 IP 地址添加到配置文件中我总是得到这个错误?
第一台机器给我这个错误:
[信息] [错误] [11/20/2018 13:58:48.833] [ClusterSystem-akka.remote.default-remote-dispatcher-6] [akka.remote.artery.Association(akka://ClusterSystem)] 出站 到 [akka://ClusterSystem@192.168.1.2:2552] 的控制流失败。 重新启动它。与 [akka://ClusterSystem@192.168.1.2:2552] 握手 未在 20000 毫秒内完成 (akka.remote.artery.OutboundHandshake$HandshakeTimeoutException: 与 [akka://ClusterSystem@192.168.1.2:2552] 握手没有 在 20000 毫秒内完成)
第二台机器:
线程“main”中的异常 akka.remote.RemoteTransportException:无法将 TCP 绑定到 [192.168.1.3:2552] 由于:绑定失败,因为 java.net.BindException:无法分配请求的地址:绑定
配置文件内容:
akka {
actor {
provider = cluster
}
remote {
artery {
enabled = on
transport = tcp
canonical.hostname = "192.168.1.3"
canonical.port = 0
}
}
cluster {
seed-nodes = [
"akka://ClusterSystem@192.168.1.3:2552",
"akka://ClusterSystem@192.168.1.2:2552"]
# auto downing is NOT safe for production deployments.
# you may want to use it during development, read more about it in the docs.
auto-down-unreachable-after = 120s
}
}
# Enable metrics extension in akka-cluster-metrics.
akka.extensions=["akka.cluster.metrics.ClusterMetricsExtension"]
# Sigar native library extract location during tests.
# Note: use per-jvm-instance folder when running multiple jvm on one host.
akka.cluster.metrics.native-library-extract-folder=${user.dir}/target/native
【问题讨论】:
-
首先你需要解决第二台电脑的绑定问题。