2016-08-03 123 views
1

我有一个客户端/服务器软件在本地工作完美,但我不明白为什么,当我在远程aws ec2实例上设置服务器时,它不起作用。当客户端试图连接我得到了以下错误:akka aws ec2连接被拒绝

[08/03/2016 12:47:36.231] [ClientSystem1213-akka.remote.default-remote-dispatcher-6] [akka.tcp://[email protected]:2555/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2FSolarServerSystem%4052.59.106.25%3A2552-0/endpointWriter] AssociationError [akka.tcp://[email protected]:2555] -> [akka.tcp://[email protected]:2552]: Error [Association failed with [akka.tcp://[email protected]:2552]] [ 
akka.remote.EndpointAssociationException: Association failed with [akka.tcp://[email protected]: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安全组入站和出站开放所有TRAFIC (所有协议 - 所有端口)。

常见到客户端和服务器的阿卡CONF是

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 
    } 
    } 

} 

(I复制粘贴德故障和缓冲来自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的摇摆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拍摄)

那里的问题来自任何线索?

回答

1

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

+0

在AWS EC2安全组入站和出站是开放的所有TRAFIC(所有协议 - 所有端口)。 – lorilan

+0

运行akka系统的ec2实例是否在vpc中? –

+0

它有一个vpc ID,所以我想是 – lorilan

1

这实际上是一个阿卡配置问题。 aws ec2实例具有公共和私有IP。公共IP在运行实例屏幕上的aws控制台中可见。私有IP在描述标签的同一屏幕的底部可见(并且在实例提示中默认)。

这两个不同的地址必须被通知给阿卡配置如下:

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 
}