I start Hazelcast with IP 127.0.0.1 and port 5701. Why it tries to connect another two ports 5702 and 5703? What are they used for, and why it failed to connect?
Below is how I configure programmatically:
Config config = new Config();
NetworkConfig network = config.getNetworkConfig();
network.setPort(5701);
JoinConfig join = network.getJoin();
join.getMulticastConfig().setEnabled(false);
join.getTcpIpConfig().setEnabled(true);
join.getTcpIpConfig().addMember("127.0.0.1");
Below is the log when starting hazelcast.
INFO: [127.0.0.1]:5701 [dev] [3.6.3] Creating TcpIpJoiner
Jun 22, 2016 11:58:41 AM com.hazelcast.core.LifecycleService
INFO: [127.0.0.1]:5701 [dev] [3.6.3] Address[127.0.0.1]:5701 is STARTING
Jun 22, 2016 11:58:41 AM com.hazelcast.nio.tcp.nonblocking.NonBlockingIOThreadingModel
INFO: [127.0.0.1]:5701 [dev] [3.6.3] TcpIpConnectionManager configured with Non Blocking IO-threading model: 3 input threads and 3 output threads
Jun 22, 2016 11:58:41 AM com.hazelcast.nio.tcp.InitConnectionTask
INFO: [127.0.0.1]:5701 [dev] [3.6.3] Connecting to /127.0.0.1:5702, timeout: 0, bind-any: true
Jun 22, 2016 11:58:41 AM com.hazelcast.nio.tcp.InitConnectionTask
INFO: [127.0.0.1]:5701 [dev] [3.6.3] Connecting to /127.0.0.1:5703, timeout: 0, bind-any: true
Jun 22, 2016 11:58:41 AM com.hazelcast.nio.tcp.InitConnectionTask
INFO: [127.0.0.1]:5701 [dev] [3.6.3] Could not connect to: /127.0.0.1:5702. Reason: SocketException[Connection refused to address /127.0.0.1:5702]
Jun 22, 2016 11:58:41 AM com.hazelcast.nio.tcp.InitConnectionTask
INFO: [127.0.0.1]:5701 [dev] [3.6.3] Could not connect to: /127.0.0.1:5703. Reason: SocketException[Connection refused to address /127.0.0.1:5703]
Jun 22, 2016 11:58:41 AM com.hazelcast.cluster.impl.TcpIpJoiner
INFO: [127.0.0.1]:5701 [dev] [3.6.3] Address[127.0.0.1]:5702 is added to the blacklist.
Jun 22, 2016 11:58:41 AM com.hazelcast.cluster.impl.TcpIpJoiner
INFO: [127.0.0.1]:5701 [dev] [3.6.3] Address[127.0.0.1]:5703 is added to the blacklist.
Jun 22, 2016 11:58:42 AM com.hazelcast.cluster.impl.TcpIpJoiner
INFO: [127.0.0.1]:5701 [dev] [3.6.3]
Thanks!
Whenever you start a Hazelcast member, it first tries to see if any other cluster members with the current configuration are already available or not. If it finds one, it will join them to form the cluster otherwise it will just start the cluster with single member.
By default, it will check the neighboring ports i.e, in your case 5702, 5703.