我有一个客户端/服务器软件在本地运行得很好,但我不知道为什么,当我在远程aws ec2实例上设置服务器时,它不能工作。当客户端尝试连接时,我得到以下错误:
[08/03/2016 12:47:36.231] [ClientSystem1213-akka.remote.default-remote-dispatcher-6] [akka.tcp://ClientSystem1213@127.0.0.1:2555/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2FSolarServerSystem%4052.59.106.25%3A2552-0/endpointWriter] AssociationError [akka.tcp://ClientSystem1213@127.0.0.1:2555] -> [akka.tcp://SolarServerSystem@52.59.106.25:2552]: Error [Association failed with [akka.tcp://SolarServerSystem@52.59.106.25:2552]] [
akka.remote.EndpointAssociationException: Association failed with [akka.tcp://SolarServerSystem@52.59.106.25:2552]
Caused by: akka.remote.transport.netty.NettyTransportExceptionNoStack: Connection refused: /52.59.106.25:2552
]在服务器上运行netstat -tnlp会得到以下结果:
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 ::ffff:127.0.0.1:2552 :::* LISTEN 4516/java aws ec2安全组入站和出站对所有传输均开放(所有协议-所有端口)。
客户端和服务器通用akka配置文件是
akka {
actor {
provider = "akka.remote.RemoteActorRefProvider"
}
remote {
enabled-transports = ["akka.remote.netty.tcp"]
netty.tcp {
hostname = "127.0.0.1"
send-buffer-size = 5000000b
receive-buffer-size = 5000000b
maximum-frame-size = 2500000b
}
watch-failure-detector {
threshold = 100
acceptable-heartbeat-pause = 20 s
}
transport-failure-detector {
heartbeat-interval = 4 s
acceptable-heartbeat-pause = 20 s
}
}
}(我从Amazon AWS EC2 ports: connection refused复制了粘贴失败和缓冲部分)
服务器只是conf的一部分:
include "common"
akka {
remote.netty.tcp.port = 2552
}客户端部分是:
include "common"
include "javafx-swing-dispatch"
akka {
remote.netty.tcp.port = 2555
remote {
log-config-on-start = on
log-sent-messages = on
log-received-messages = on
}
}javafx-swing-dispatch.conf是:
javafx-dispatcher {
type = "Dispatcher"
executor = "akka.dispatch.gui.JavaFXEventThreadExecutorServiceConfigurator"
throughput = 1
}
swing-dispatcher {
type = "Dispatcher"
executor = "akka.dispatch.gui.SwingEventThreadExecutorServiceConfigurator"
throughput = 1
}(摘自https://gist.github.com/mucaho/8973013)
有什么线索是问题出在哪里吗?
发布于 2016-08-26 19:29:12
这实际上是一个akka配置问题。亚马逊网络服务ec2实例有一个公网ip和一个内网ip。您可以在aws控制台的运行实例屏幕上看到该公网ip。内网ip在同一屏幕下方的描述页签中可见(默认在实例提示符下)。
这两个不同的地址必须通知给akka配置,如下所示:
akka.remote.netty.tcp {
hostname = "XX.XX.XX.XX" # external/public (logical) hostname
port = 2555 # external/public (logical) port
bind-hostname = "192.168.0.4" # internal/private (bind) hostname
bind-port = 2555 # internal/private (bind) port
}发布于 2016-08-03 17:07:55
您需要在ec2实例的安全配置中允许流量,因为您需要打开您正在用于akka系统的端口。
https://stackoverflow.com/questions/38739112
复制相似问题