首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >akka aws ec2连接被拒绝

akka aws ec2连接被拒绝
EN

Stack Overflow用户
提问于 2016-08-03 17:05:27
回答 2查看 494关注 0票数 1

我有一个客户端/服务器软件在本地运行得很好,但我不知道为什么,当我在远程aws ec2实例上设置服务器时,它不能工作。当客户端尝试连接时,我得到以下错误:

代码语言:javascript
运行
复制
    [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会得到以下结果:

代码语言:javascript
运行
复制
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配置文件是

代码语言:javascript
运行
复制
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的一部分:

代码语言:javascript
运行
复制
include "common"

akka {
  remote.netty.tcp.port = 2552
}

客户端部分是:

代码语言:javascript
运行
复制
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是:

代码语言:javascript
运行
复制
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)

有什么线索是问题出在哪里吗?

EN

回答 2

Stack Overflow用户

发布于 2016-08-26 19:29:12

这实际上是一个akka配置问题。亚马逊网络服务ec2实例有一个公网ip和一个内网ip。您可以在aws控制台的运行实例屏幕上看到该公网ip。内网ip在同一屏幕下方的描述页签中可见(默认在实例提示符下)。

这两个不同的地址必须通知给akka配置,如下所示:

代码语言:javascript
运行
复制
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
}
票数 3
EN

Stack Overflow用户

发布于 2016-08-03 17:07:55

您需要在ec2实例的安全配置中允许流量,因为您需要打开您正在用于akka系统的端口。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38739112

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档