0

My application runs in two different VMs and they have the same configuration. When the second node runs up after the first one, Hazelcast members in different servers join, but they cannot initiate the communication.

App uses TCP/IP for the discovery and there are also network interfaces configured.

Here is my config code:

@Bean
public NetworkConfig networkConfig(final Config hazelCastConfiguration) throws UnknownHostException {
    final NetworkConfig network = hazelCastConfiguration.getNetworkConfig();
    network.setPort(port);
    network.setPortAutoIncrement(true);

    final JoinConfig join = network.getJoin();
    final MulticastConfig multicast = join.getMulticastConfig();
    multicast.setEnabled(false);

    final TcpIpConfig tcpIp = join.getTcpIpConfig();

    tcpIp.setEnabled(true);
    for (final String member : members) {
        final InetAddress[] addresses = MoreObjects.firstNonNull(
                InetAddress.getAllByName(member),
                new InetAddress[0]);
        for (final InetAddress addr : addresses) {
            final String hostAddress = addr.getHostAddress();
            tcpIp.addMember(hostAddress);
            log.info("[Hazelcast] New Member: " + hostAddress);
        }
    }
    return network;
}

And:

final InterfacesConfig interfacesConfig = network.getInterfaces();

interfacesConfig.setEnabled(true);

for (final String networkInterface : interfaces) {
    log.info("[Hazelcast] Interface:  " + networkInterface);
    network.getInterfaces().addInterface(networkInterface);
    log.info("[Hazelcast] Interface:  " + network.getInterfaces());
}

Because the application runs in a different server, I set up members and the interface as follows:

"HOST1IP" and "HOST2IP" 

When I run the apps, I get the following logs:

Members {size:2, ver:6} [
Member ["HOSTIP1"]:5702 - 6a356dc6-4b16-49dd-8cb5-a7df62f7c2d2 this
Member ["HOSTIP2"]:5702 - 015b5b34-657f-4b38-8b67-17810777ac2e
]

Members join, and then:

com.hazelcast.nio.tcp.TcpIpConnection    
: ["HOSTIP1"]:5702 [example-app] [3.11.4] Initialized new cluster connection between /"HOSTIP2":53725 and /"HOSTIP2":5701

I am expecting to initiate a connection to "HOSTIP2":5702 but it doesn't.

Any ideas, or help very appreciated.

Oliv
  • 10,221
  • 3
  • 55
  • 76
  • 1
    The rest of the logs would be helpful, but it's worth noting `Initialized new cluster connection between /"HOSTIP2":53725 and /"HOSTIP2":5701` references port 5701 (the default), but your cluster list has both servers on port 5702. – Neil Stevenson Sep 18 '20 at 12:57
  • Did you get this solved ? – Neil Stevenson Sep 26 '20 at 09:48

0 Answers0