我使用IP 127.0.0.1和端口5701启动Hazelcast。为什么它尝试连接另外两个端口5702和5703?他们使用了什么,为什么连接失败?
以下是我以编程方式配置的方式:
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");
以下是启动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]
谢谢!
答案 0 :(得分:2)
每当您启动Hazelcast成员时,它首先会尝试查看是否已有任何其他具有当前配置的集群成员。如果找到一个,它将连接它们以形成集群,否则它将只用单个成员启动集群 默认情况下,它会检查相邻的端口,例如5702,5703。