与amazon AWS

时间:2016-04-01 20:08:14

标签: amazon-web-services amazon-ec2 hazelcast

我在两台亚马逊AWS虚拟机上使用Hazelcast v3.6(不使用特定于AWS的设置进行淡化广播)。该连接应该通过TCP / IP连接设置(不是多播)工作。我在虚拟机上打开了5701-5801地址进行连接 我已经尝试在两个虚拟机上使用iperf,我可以看到一个虚拟机上的客户端连接到另一个虚拟机上的服务器(反之亦然,当我切换iperf的客户端服务器设置时)。

当我在不同的VM上启动两个Hazelcast服务器时,未建立连接。下面给出了日志语句和hazelcast.xml配置(我没有使用Hazelcast的编程设置)。我已经更改了以下IP地址:

20160401-16:41:02.812 [cached2] InitConnectionTask INFO - [45.46.47.48]:5701 [dev] [3.6] Connecting to /22.23.24.25:5701, timeout: 0, bind-any: true
20160401-16:41:02.812 [cached3] InitConnectionTask INFO - [45.46.47.48]:5701 [dev] [3.6] Connecting to /22.23.24.25:5703, timeout: 0, bind-any: true
20160401-16:41:02.813 [cached1] InitConnectionTask INFO - [45.46.47.48]:5701 [dev] [3.6] Connecting to /22.23.24.25:5702, timeout: 0, bind-any: true
20160401-16:41:02.816 [cached1] InitConnectionTask INFO - [45.46.47.48]:5701 [dev] [3.6] Could not connect to: /22.23.24.25:5702. Reason: SocketException[Connection refused to address /22.23.24.25:570
2]
20160401-16:41:02.816 [cached1] TcpIpJoiner INFO - [45.46.47.48]:5701 [dev] [3.6] Address[22.23.24.25]:5702 is added to the blacklist.
20160401-16:41:02.817 [cached3] InitConnectionTask INFO - [45.46.47.48]:5701 [dev] [3.6] Could not connect to: /22.23.24.25:5703. Reason: SocketException[Connection refused to address /22.23.24.25:570
3]
20160401-16:41:02.817 [cached3] TcpIpJoiner INFO - [45.46.47.48]:5701 [dev] [3.6] Address[22.23.24.25]:5703 is added to the blacklist.
20160401-16:41:02.834 [cached2] TcpIpConnectionManager INFO - [45.46.47.48]:5701 [dev] [3.6] Established socket connection between /45.46.47.48:51965 and /22.23.24.25:5701
20160401-16:41:02.849 [hz._hzInstance_1_dev.IO.thread-in-0] TcpIpConnection INFO - [45.46.47.48]:5701 [dev] [3.6] Connection [Address[22.23.24.25]:5701] lost. Reason: java.io.EOFException[Remote socket 
closed!]
20160401-16:41:02.851 [hz._hzInstance_1_dev.IO.thread-in-0] NonBlockingSocketReader WARN - [45.46.47.48]:5701 [dev] [3.6] hz._hzInstance_1_dev.IO.thread-in-0 Closing socket to endpoint Address[54.89.161.2
28]:5701, Cause:java.io.EOFException: Remote socket closed!
20160401-16:41:03.692 [cached2] InitConnectionTask INFO - [45.46.47.48]:5701 [dev] [3.6] Connecting to /22.23.24.25:5701, timeout: 0, bind-any: true
20160401-16:41:03.693 [cached2] TcpIpConnectionManager INFO - [45.46.47.48]:5701 [dev] [3.6] Established socket connection between /45.46.47.48:60733 and /22.23.24.25:5701
20160401-16:41:03.696 [hz._hzInstance_1_dev.IO.thread-in-1] TcpIpConnection INFO - [45.46.47.48]:5701 [dev] [3.6] Connection [Address[22.23.24.25]:5701] lost. Reason: java.io.EOFException[Remote socket 
closed!]

Hazelcast配置的一部分

<?xml version="1.0" encoding="UTF-8"?>
<hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.6.xsd"
           xmlns="http://www.hazelcast.com/schema/config"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <group>
        <name>abc</name>
        <password>defg</password>
    </group>

    <network>
        <port auto-increment="true" port-count="100">5701</port>
        <outbound-ports>
            <ports>0-5900</ports>
        </outbound-ports>
        <join>
            <multicast enabled="false">
                <!--<multicast-group>224.2.2.3</multicast-group>
                <multicast-port>54327</multicast-port>-->
            </multicast>
            <tcp-ip enabled="true">
                <member>22.23.24.25</member> 
             </tcp-ip>
        </join>
        <interfaces enabled="true">
            <interface>45.46.47.48</interface>
        </interfaces>
        <ssl enabled="false" />
        <socket-interceptor enabled="false" />
        <symmetric-encryption enabled="false">
            <algorithm>PBEWithMD5AndDES</algorithm>
            <!-- salt value to use when generating the secret key -->
            <salt>thesalt</salt>
            <!-- pass phrase to use when generating the secret key -->
            <password>thepass</password>
            <!-- iteration count to use when generating the secret key -->
            <iteration-count>19</iteration-count>
        </symmetric-encryption>
    </network>

    <partition-group enabled="false"/>

iperf服务器和客户端日志语句

Server listening on TCP port 5701
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
------------------------------------------------------------
Client connecting to 22.23.24.25, TCP port 5701
TCP window size: 1.33 MByte (default)
------------------------------------------------------------
[  5] local 172.31.17.104 port 57398 connected with 22.23.24.25 port 5701
[  4] local 172.31.17.104 port 5701 connected with 22.23.24.25 port 55589
[ ID] Interval       Transfer     Bandwidth
[  5]  0.0-10.0 sec   662 MBytes   555 Mbits/sec
[  4]  0.0-10.0 sec   797 MBytes   666 Mbits/sec


Server listening on TCP port 5701
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
[  4] local xxx.xx.xxx.xx port 5701 connected with 22.23.24.25 port 57398
------------------------------------------------------------
Client connecting to 22.23.24.25, TCP port 5701
TCP window size: 1.62 MByte (default)
------------------------------------------------------------
[  6] local 172.31.17.23 port 55589 connected with 22.23.24.25 port 5701
[ ID] Interval       Transfer     Bandwidth
[  6]  0.0-10.0 sec   797 MBytes   669 Mbits/sec
[  4]  0.0-10.0 sec   662 MBytes   553 Mbits/sec

注意: 我忘了提到我可以从hazelcast客户端连接到服务器,即当我使用hazelcast客户端连接到单个hazlecast服务器节点时,我能够连接得很好

1 个答案:

答案 0 :(得分:4)

包含0的出站端口范围由hazelcast解释为“使用临时端口”,因此<outbound-ports>元素实际上对您的配置没有影响。在淡褐色来源中有一个相关的测试:https://github.com/hazelcast/hazelcast/blob/75251c4f01d131a9624fc3d0c4190de5cdf7d93a/hazelcast/src/test/java/com/hazelcast/nio/NodeIOServiceTest.java#L60