hazelcast客户端无法连接到服务器

时间:2014-09-05 00:35:30

标签: java hazelcast

我使用的是hazelcast(客户端的hazelcast客户端和服务器jar以及服务器上的服务器jar - 两个版本都是相同的,即3.2.4)。服务器在另一个盒子上运行 - 我在客户端指定了该IP地址。看来服务器正在运行(我可以看到进程已启动并且绑定在5701端口上)。我的客户端尝试连接到远程IP地址和端口,但无法这样做,并且hazlecast消息没有多大帮助(除非我错误配置了日志记录)。输出如下:

Sep 04, 2014 8:30:45 PM com.hazelcast.core.LifecycleService
INFO: HazelcastClient[hz.client_0_dev][3.2.4] is STARTING
Sep 04, 2014 8:30:46 PM com.hazelcast.core.LifecycleService
INFO: HazelcastClient[hz.client_0_dev][3.2.4] is STARTED
Sep 04, 2014 8:30:49 PM com.hazelcast.client.spi.ClientClusterService
WARNING: Unable to get alive cluster connection, try in 0 ms later, attempt 1 of 2.
Sep 04, 2014 8:30:52 PM com.hazelcast.client.spi.ClientClusterService
WARNING: Unable to get alive cluster connection, try in 0 ms later, attempt 2 of 2.
Sep 04, 2014 8:30:55 PM com.hazelcast.client.spi.ClientClusterService

配置文件部分:

<network>
        <port auto-increment="true" port-count="100">5701</port>
        <outbound-ports>
            <!--
            Allowed port range when connecting to other nodes.
            0 or * means use system provided port.
            -->
            <ports>0</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">
                <interface>127.0.0.1</interface>
            </tcp-ip>
            <aws enabled="false">
            </aws>
        </join>
        <interfaces enabled="false">
            <interface>10.10.1.*</interface>
        </interfaces>
        <ssl enabled="false" />
        <socket-interceptor enabled="false" />
        <symmetric-encryption enabled="false">
            <algorithm>PBEWithMD5AndDES</algorithm>
            <salt>fakesalt</salt>
            <password>fakepwd</password>
            <iteration-count>19</iteration-count>
        </symmetric-encryption>
    </network>

任何有关故障排除的帮助都很棒

修改 我能够使用iperf在两台服务器(通过端口5701托管客户端和服务器)之间展开网络流量。

------------------------------------------------------------
Server listening on TCP port 5701
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
------------------------------------------------------------
Client connecting to xxx.xxx.xxx.xxx, TCP port 5701
TCP window size:  101 KByte (default)
------------------------------------------------------------
[  3] local xxx.xxx.xxx.xxx port 40937 connected with xxx.xxx.xxx.xxx port 5701
[  5] local xxx.xxx.xxx.xxx port 5701 connected with xxx.xxx.xxx.xxx port 51788
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec  3.31 GBytes  2.84 Gbits/sec
[  5]  0.0-10.0 sec  3.20 GBytes  2.75 Gbits/sec

1 个答案:

答案 0 :(得分:2)

确保您使用的是hazelcast-client配置文件,最好使用简单的服务器和客户端通过tcp / ip进行测试。

<hazelcast-client xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-client-config-3.1.xsd"
           xmlns="http://www.hazelcast.com/schema/config"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <group>
        <name>dev</name> 
        <password>dev-pass</password> 
    </group>
    <management-center enabled="false">http://localhost:8080/mancenter</management-center>
    <network>
       <cluster-members>
            <address>127.0.0.1</address>
        </cluster-members>
        <smart-routing>true</smart-routing>
        <redo-operation>true</redo-operation>
        <connection-pool-size>30</connection-pool-size>

        <port auto-increment="true" port-count="100">5701</port>
        <outbound-ports>
            <ports>0</ports>
        </outbound-ports>
        <join>
            <multicast enabled="false">
                <multicast-group>224.2.2.3</multicast-group>
                <multicast-port>54327</multicast-port>
            </multicast>
            <tcp-ip enabled="false">
                <interface>127.0.0.1</interface>
            </tcp-ip>
            <aws enabled="false">
                <access-key>my-access-key</access-key>
                <secret-key>my-secret-key</secret-key>
                <region>us-west-1</region>
                <host-header>ec2.amazonaws.com</host-header>
                <security-group-name>hazelcast-sg</security-group-name>
                <tag-key>type</tag-key>
                <tag-value>hz-nodes</tag-value>
            </aws>
        </join>
        <interfaces enabled="false">
            <interface>10.10.1.*</interface>
        </interfaces>
        <ssl enabled="false" />
        <socket-interceptor enabled="false" />
        <symmetric-encryption enabled="false">
            <algorithm>PBEWithMD5AndDES</algorithm>
            <salt>thesalt</salt>
            <password>thepass</password>
            <iteration-count>19</iteration-count>
        </symmetric-encryption>
    </network>
<!-- additional tags -->
</hazelcast-client>