【发布时间】:2020-09-29 23:22:48
【问题描述】:
我正在尝试使用 Akka Clustering 制作一个项目,并且一直使用 Lightbend(https://github.com/akka/akka-samples/tree/2.6/akka-sample-cluster-scala) 的 akka-cluster-sample-scala 作为基础。由于它缺少很多关于通过网络连接的直接信息,我修改了 application.conf 使其看起来更像这样:
akka {
actor {
provider = cluster
serialization-bindings {
"sample.cluster.CborSerializable" = jackson-cbor
}
}
remote {
artery {
canonical.hostname = "127.0.0.1"
canonical.port = 0
}
}
cluster {
seed-nodes = [
"akka://ClusterSystem@131.194.71.132:25251",
"akka://ClusterSystem@131.194.71.132:25252",
"akka://ClusterSystem@131.194.71.133:25251",
"akka://ClusterSystem@131.194.71.133:25252"]
downing-provider-class = "akka.cluster.sbr.SplitBrainResolverProvider"
}
}
在这两台机器上运行时,Akka 无法在它们之间通过 TCP 连接,导致以下警告:
[info] [2020-09-28 14:34:37,877] [WARN] [akka.stream.Materializer] [] [ClusterSystem-akka.actor.default-dispatcher-5] - [outbound connection to [akka://ClusterSystem@131.194.71.132:25251], control stream] Upstream failed, cause: StreamTcpException: Tcp command [Connect(131.194.71.132:25251,None,List(),Some(5000 milliseconds),true)] failed because of java.net.ConnectException: Connection refused
是否有任何明显的错误可能导致这种情况,或者需要重新配置更具体的东西以允许这些机器之间通过 TCP 连接?
【问题讨论】: