Configuring two <a630> hazelcast clusters - avoiding multicast
Context
Two nodes of the Hazelcast cluster, each of which is on a discrete subnet, so multicast is not suitable and does not work for the node location.
I would like to use the smallest XML configuration file, such as
hazelcast.xml, to configure Hazelcast to use TCP / IP to connect these two nodes. Ideally, this is a directory of IP addresses of two nodes.
Question
Hazelcast docs show well how this can be achieved programmatically , and how hazelcast.jar/hazelcast-default.xml contains a (significant) default configuration,
Which is unclear: is there any XML configuration that I supply that overlaps the settings in hazelcast-default.xml - or is it just used instead?
I have my answers and I would like to share them
Like the software API, the XML configuration imposes the default values ββfound in
hazelcast.jar/hazelcast-default.xml, hence ...I can install a very simple two-member cluster with this
hazelcast.xmlin the classpath<hazelcast> <network> <join> <multicast enabled="false"></multicast> <tcp-ip enabled="true"> <member>192.168.100.001</member> <!-- server A --> <member>192.168.102.200</member> <!-- server B, on separate subnet --> </tcp-ip> </join> </network> </hazelcast>
I am not familiar with hazelcast.conf files.
Mostly used XML or Programmatic api. For good examples see:
https://github.com/hazelcast/hazelcast-code-samples/tree/master/network-configuration
Program Example:
public class Main { public static void main(String[] args){ Config config = new Config(); config.getNetworkConfig().getJoin().getTcpIpConfig().addMember("localhost").setEnabled(true); config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false); HazelcastInstance hz = Hazelcast.newHazelcastInstance(config); } } - What is unclear: is there any XML configuration that I supply that overlaps the settings in the hazelcast-default.xml file or is it just used instead?
What do you mean? If you use the software API, the rest does not matter. If you do not provide an explicit Config object when building HazelcastInstance, the default mechanism is used. And ultimately it defaults to using the hazelcast-default.xml file.