2016-08-03 117 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 
}