AWS上的Hazelcast-client配置

时间:2017-10-04 04:17:16

标签: java amazon-web-services hazelcast

我的问题是关于hazelcast-client配置。 根据我的理解,如果配置正确,客户端应该从AWS api自动获取hazelcast服务器节点IP,问题是甚至没有尝试连接。

这是我发现的一些日志。

Caused by: java.lang.IllegalStateException: Unable to connect to any address in the config! The following addresses were tried: []
    at com.hazelcast.client.spi.impl.ClusterListenerSupport.connectToCluster(ClusterListenerSupport.java:178)
    at com.hazelcast.client.spi.impl.ClientClusterServiceImpl.start(ClientClusterServiceImpl.java:189)

也是这里的客户端conifig

<bean id="hazelcastInstance" class="com.hazelcast.client.HazelcastClient"  factory-method="newHazelcastClient">
        <constructor-arg>
            <bean class="com.hazelcast.client.config.ClientConfig">
                <property name="groupConfig">
                    <bean class="com.hazelcast.config.GroupConfig">
                        <property name="name" value="dev"/>
                    </bean>
                    </property>

                     <property name="properties">
                       <props>
                       <prop key="hazelcast.icmp.enabled">true</prop>
                       </props>
                     </property>
                <property name="networkConfig">
                    <bean class="com.hazelcast.client.config.ClientNetworkConfig">

                    <property name="awsConfig">
                            <bean class="com.hazelcast.client.config.ClientAwsConfig">
                                <property name="insideAws" value="true" />
                                <property name="enabled" value="${hazelcast.aws.enabled:false}" />
                                <property name="region" value="${hazelcast.aws.region:set-me}" />
                                <property name="accessKey"value="key" />

                                <property name="secretKey" value="secret"/>


                                <property name="hostHeader" value="ec2.amazonaws.com"/>
                                <property name="iamRole" value="${hazelcast.aws.iam.role:#{null}}"/>
                                <!-- <property name="securityGroupName" value="${hazelcast.aws.securityGroupName:#{null}}" /> -->
                                <property name="tagKey" value="${hazelcast.aws.tagKey:hazelcast-cluster}" />
                                <property name="tagValue" value="${hazelcast.aws.tagValue:#{null}}" />
                                <property name="connectionTimeoutSeconds" value="${hazelcast.aws.connectionTimeout:15}" />

                            </bean>
                        </property> 
                    </bean>
                </property>
            </bean>

        </constructor-arg>
    </bean>

还尝试强制服务器ip,这有效。我需要客户端自动发现服务器ips。任何线索?

1 个答案:

答案 0 :(得分:0)

如果您希望客户端在AWS(或任何其他云)上发现群集,则需要使用发现插件机制。旧的AWS发现仅供会员使用。

请参阅https://github.com/hazelcast/hazelcast-aws