I am new to Hazelcast, I am trying to develop a project with two instances on two different computers (and IPs). Let's say these two are IPs: 10.200.1.1 and 10.200.2.2. Both projects work on Eclipse Mars/Tomcat 7
Here is my config:
Config cfg = new Config();
NetworkConfig network = cfg.getNetworkConfig();
JoinConfig join = network.getJoin();
join.getMulticastConfig().setEnabled(false);
join.getTcpIpConfig().addMember("10.200.1.1")
.addMember("10.200.2.2").setEnabled(true);
network.getInterfaces().setEnabled(true)
.addInterface("10.200.2.2").addInterface("10.200.1.1");
HazelcastInstance instance = Hazelcast.newHazelcastInstance();
I see individually this log and I confirm that these two instances are working:
Şub 12, 2015 9:26:01 AM com.hazelcast.config.XmlConfigLocator
INFO: Loading 'hazelcast-default.xml' from classpath.
Şub 12, 2015 9:26:01 AM com.hazelcast.instance.DefaultAddressPicker
INFO: [LOCAL] [dev] [3.4] Prefer IPv4 stack is true.
Şub 12, 2015 9:26:02 AM com.hazelcast.instance.DefaultAddressPicker
INFO: [LOCAL] [dev] [3.4] Picked Address[192.168.56.1]:5701, using socket ServerSocket[addr=/0:0:0:0:0:0:0:0,localport=5701], bind any local is true
Şub 12, 2015 9:26:02 AM com.hazelcast.spi.OperationService
INFO: [192.168.56.1]:5701 [dev] [3.4] Backpressure is disabled
Şub 12, 2015 9:26:02 AM com.hazelcast.spi.impl.BasicOperationScheduler
INFO: [192.168.56.1]:5701 [dev] [3.4] Starting with 4 generic operation threads and 8 partition operation threads.
Şub 12, 2015 9:26:02 AM com.hazelcast.system
INFO: [192.168.56.1]:5701 [dev] [3.4] Hazelcast 3.4 (20141224 - 3dc5214) starting at Address[192.168.56.1]:5701
Şub 12, 2015 9:26:02 AM com.hazelcast.system
INFO: [192.168.56.1]:5701 [dev] [3.4] Copyright (C) 2008-2014 Hazelcast.com
Şub 12, 2015 9:26:02 AM com.hazelcast.instance.Node
INFO: [192.168.56.1]:5701 [dev] [3.4] Creating MulticastJoiner
Şub 12, 2015 9:26:02 AM com.hazelcast.core.LifecycleService
INFO: [192.168.56.1]:5701 [dev] [3.4] Address[192.168.56.1]:5701 is STARTING
Şub 12, 2015 9:26:05 AM com.hazelcast.cluster.impl.MulticastJoiner
INFO: [192.168.56.1]:5701 [dev] [3.4]
Members [1] {
Member [192.168.56.1]:5701 this
}
Şub 12, 2015 9:26:05 AM com.hazelcast.core.LifecycleService
INFO: [192.168.56.1]:5701 [dev] [3.4] Address[192.168.56.1]:5701 is STARTED
But they don't see each other. There is no firewall issue, I can connect each two ports by using telnet and I confirm that there is no network issue.
What do I have to do?
Hazelcast version is 3.4
the configuration seems to be correct however you have to pass it to the factory method when you are creating a new Hazelcast instance. Instead of
HazelcastInstance instance = Hazelcast.newHazelcastInstance();
you should use:
HazelcastInstance instance = Hazelcast.newHazelcastInstance(config);