Search code examples
hazelcast

Hazelcast client conneciton port


I have a multi-service deployment where some of the services use Hazelcast for caching. On actual deployments, where is service resides in a separate VM, the hazelcast instance starts on port 5701. However, when doing tests locally, all services reside on the same VM. This means that the first Hazelcast instance starts on 5701, the second on 5702 and so on (auto-increment is set to true in the configuration).

The problem is that the hazelcast client tries to connect to the 5701 to 5703 and does not search any further.

To make sure I don't have any overlap in the ports (so no auto-incrementation is done) I manually configured the ports for the Hazelcast Instance. So, for one of the services I set it to 5710. However, the client tries to connect from 5701.

I've read that network->port is not available for Hazelcast Client config, but I could not find how to specify the port to try to connect?

I am using Hazelcast 3.6

Config file:

    <group>
        <name>myNode</name>
        <password>MyPass</password>
    </group>
    <properties>
        <property name="hazelcast.rest.enabled">true</property>
        <property name="hazelcast.shutdownhook.enabled">false</property>
    </properties>
    <management-center enabled="false"/>
    <network>
        <port auto-increment="true">5701</port>
        <join>
            <multicast enabled="true"/>
            <tcp-ip enabled="false"/>
            <aws enabled="false"/>
        </join>
    </network>

Solution

  • The solution was to add the cluster configuration to the client-configuration xml:

       <network>
            <cluster-members>
                <address>127.0.0.1:57xx</address>
            </cluster-members>
        </network>