我正在设置一个Akka群集,以便能够使用Artery远程处理连接到其他节点。 我按照以下教程设置了几个本地节点来模拟这种效果(https://developer.lightbend.com/docs/akka-management/current/bootstrap/local-config.html),并且可以正常工作。这是我的配置文件:
akka {
loglevel = INFO
actor {
provider = "cluster"
}
remote {
artery {
enabled = on
transport = tcp
hostname = "MY_PUBLIC_IP_ADDRESS(130.231.......)"
canonical.port = 2551
}
}
}
#coorindated-shutdown
akka.cluster.shutdown-after-unsuccessful-join-seed-nodes = 30s
akka.coordinated-shutdown.exit-jvm = on
#coorindated-shutdown
#discovery
akka.discovery {
config.services = {
local-cluster = {
endpoints = [
{
host = "127.0.0.2"
port = 8558
},
{
host = "127.0.0.3"
port = 8558
}
]
}
}
}
#discovery
#health
akka.management.health-checks {
readiness-path = "health/ready"
liveness-path = "health/alive"
}
#health
akka.management.http {
route-providers-read-only = false
}
#bootstrap
akka.management {
cluster.bootstrap {
contact-point-discovery {
service-name = "local-cluster"
discovery-method = config
}
}
}
#bootstrap
现在,当我在具有另一个IP地址的另一台计算机上启动该程序的完全相同的实例,并在akka.discovery.config.services.local-cluster.endpoints
中提供该IP地址时,引导程序完全失败(它甚至无法发现以前的可以继续使用127.0.0.2地址),导致我的连接被对等错误消息拒绝。
您知道我要在完全远程的情况下进行此工作时缺少的其他设置吗?谢谢!
答案 0 :(得分:0)
我对此的解决方法最终是切换到种子节点设置(不再进行发现)并以以下格式对IP进行硬编码:
akka://{CLUSTER_NAME}@{REMOTE_IP}:{PORT}