我有以下hz配置
Config config = new Config();
config.getGroupConfig().setName("dev");
config.getGroupConfig().setPassword("dev");
config.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(true);
config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);
config.getNetworkConfig().getJoin().getAwsConfig().setEnabled(false);
config.getNetworkConfig().getJoin().getTcpIpConfig().addMember(ip1).addMember(ip2);
config.getNetworkConfig().setInterfaces(new InterfacesConfig().setEnabled(true).addInterface(ip1).addInterface(ip2));
return Hazelcast.newHazelcastInstance(config);
ip1和ip2上的实例能够互相发现。但是当我将localhost添加到下面的成员时,每个都被视为单独的集群。为什么会这样?
config.getNetworkConfig().getJoin().getTcpIpConfig().addMember(ip1).addMember(ip2).addMember("127.0.0.1");
config.getNetworkConfig().setInterfaces(new InterfacesConfig().setEnabled(true).addInterface(ip1).addInterface(ip2).addInterface("127.0.0.1"));
来自日志:
ip1成员{size:1,ver:1} [成员[127.0.0.1]:5701 - eba14082-5749-4f22-81fa-992d82bc33ce this]
ip2成员{size:1,ver:1} [成员[127.0.0.1]:5701 - 83d03ec0-124d-4a74-965a-833fecca9dd7 this]
ip3成员{size:1,ver:1} [成员[127.0.0.1]:5701 - 0a983823-b377-4b79-b323-7e2b2dc1cce2 this]