Configuring a two node hazelcast cluster - avoiding multicast

后端 未结 2 538
隐瞒了意图╮
隐瞒了意图╮ 2021-02-03 12:20

The context

  • Two nodes of a Hazelcast cluster, each on a discrete subnet so multicast is not suitable nor working for node location.

2条回答
  •  一整个雨季
    2021-02-03 12:33

    I'm not familiar with hazelcast.conf files.

    Mostly used is XML or Programmatic api. For good examples see:

    https://github.com/hazelcast/hazelcast-code-samples/tree/master/network-configuration

    Example of programmatic:

    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: is any XML configuration I supply overlaid upon the settings within hazelcast-default.xml - or simply used in its stead?

    What do you mean? If you use the programmatic API, the rest is not relevant. If you don't provide an explicit Config object while constructing the HazelcastInstance, a defaulting mechanism is used. And eventually it defaults to hazelcast-default.xml.

提交回复
热议问题