1

I upgraded my hazelcast from 2.x to 3.3.3, but when I started 2 servers at different IPs, it's not clustered.

But it worked when I was using 2.x. It should be like this printing in console:

Members [1] {
        Member [172.29.110.114]:5701 this
}

I tried using

**Hazelcast.newHazelcastInstance()**

and

**Hazelcast.newHazelcastInstance(config)**

to get the HazelcastInstance for getting the map and other distributed objects. When I used the second one, the config as the parameter, the above message can be printed but the other IP's node can't be shown. when I used the first one without config as its parameter, I can't even see the above message in console.

Anyone knows what's going on here? Many thanks.

2 Answers 2

0

You need to enable multicast in your hazelcast configuration. Here is how to enabled it with the xml configuration (i.e. hazelcast.xml):

<hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config http://www.hazelcast.com/schema/config/hazelcast-config-3.0.xsd" xmlns=" http://www.hazelcast.com/schema/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<network>
    <join><multicast enabled="true"/></join>
<network>
</hazelcast>

Then create your config this way (hazelcast.xml shoud be in the classpath):

Config config = new ClasspathXmlConfig("hazelcast.xml")
9
  • I'm using the default configuration, which is like this: <multicast enabled="true"> <multicast-group>224.2.2.3</multicast-group> <multicast-port>54327</multicast-port> </multicast> The enabled is set to true.
    – Sky
    Jan 6, 2015 at 9:59
  • I updated my answer, you should create the config via ClasspathXmlConfig in order for the configuration in the xml file to be used.
    – bachr
    Jan 6, 2015 at 10:09
  • Should I overplay my hazelcast.xml as what you provided? Currently, I only have my own hazelcast.xml with the management center enabled.
    – Sky
    Jan 6, 2015 at 10:16
  • You can keep your old config (if you have named caches, ...). What I provide is the minimal thing you need to enable nodes discovery.
    – bachr
    Jan 6, 2015 at 10:19
  • is the ip address 224.2.2.3 belongs to one of your instances? because your node have another one 172.29.110.114 and with a different port 5701!!
    – bachr
    Jan 6, 2015 at 10:24
0

Finally, I find out what's going on. It's all because the firewall. After I turned if off, it works. Just sharing my experience. And thanks the help of Arbi.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.