Search code examples
spring-boothazelcast

Server unable to join Hazelcast cluster via multicast enabled?


I have same Hazelcast server project running at 3 different server's, two of them are able to form the cluster but the third server does not join. I have created Hazelcast server project using spring-boot. Here are my Spring Boot Hazelcast config.

    @Bean
    public Config hazelCastConfig() {
        Config config = new Config();
        config.getNetworkConfig().setPortAutoIncrement(true);
        config.setClusterName("myHazelcastStore");
        NetworkConfig network = config.getNetworkConfig();
        JoinConfig join = network.getJoin();
        join.getMulticastConfig().setEnabled(true);
        return config;
    }
    
    @Bean
    public HazelcastInstance hazelcastInstance(Config hazelCastConfig) {
        return Hazelcast.newHazelcastInstance(hazelCastConfig);
    }
    
    @Bean
    public Map<String, EmployeeAccount> employeeMap(HazelcastInstance hazelcastInstance) {
        return hazelcastInstance.getMap("employeeMap");
    }

I am using latest stable version of Hazelcast IMDG v4.2.2. I have enabled multicast in Hazelcast config. My IP for three server's are:

192.168.1.10
192.168.1.25
192.168.34.122

Here two are in same series and one is different. Is this the reason. Or is there any limitation in free edition of Hazelcast as only 2 server's can form the cluster?


Solution

  • There is no limitation in Hazelcast Open Source (free) version. You can create as big a cluster as you want.

    Concerning your issue, Multicast should work correctly. If it does not, I would check the following parts:

    1. Try to use static TCP/IP configuration (if it does not work, then it's a connectivity issue, not a discoverability issue).

    2. If TCP/IP works, then the next thing to check is if Multicast packets work in your network (sometimes they may be blocked).

    3. If you still have an issue, could you attach Hazeclast logs?