下面是文檔中給出的HazelCast編程配置,但無法在HazelCast羣集中添加成員。HazelCast Tcp-IP的編程配置沒有在羣集中添加成員
Config cfg = new Config();
Hazelcast.newHazelcastInstance(cfg);
cfg.setProperty("hazelcast.initial.min.cluster.size","3");
cfg.getGroupConfig().setName("DEV").setPassword("DEV-pass");
NetworkConfig network = cfg.getNetworkConfig();
JoinConfig join = network.getJoin();
TcpIpConfig tcpipConfig=join.getTcpIpConfig();
tcpipConfig.addMember("172.17.153.87").addMember("10.45.67.100")
.setRequiredMember("192.168.10.100").setEnabled(true);
network.getInterfaces().setEnabled(true).addInterface("10.45.67.*");
System.out.println(tcpipConfig.isEnabled());
System.out.println(tcpipConfig.getMembers());
MapConfig mapCfg = new MapConfig();
mapCfg.setName("testMap");
mapCfg.setBackupCount(2);
mapCfg.getMaxSizeConfig().setSize(10000);
mapCfg.setTimeToLiveSeconds(300);
MapStoreConfig mapStoreCfg = new MapStoreConfig();
mapStoreCfg.setClassName("com.hazelcast.examples.DummyStore").setEnabled(true);
mapCfg.setMapStoreConfig(mapStoreCfg);
NearCacheConfig nearCacheConfig = new NearCacheConfig();
nearCacheConfig.setMaxSize(1000).setMaxIdleSeconds(120).setTimeToLiveSeconds(300);
mapCfg.setNearCacheConfig(nearCacheConfig);
cfg.addMapConfig(mapCfg);
請看看代碼,讓我,如果任何事情進一步修改才能添加成員hazelcast集羣
由於它的工作 –