0
votes

I'm trying to expose hazelcast cache with embedded setup in my service, its works fine in my local, even its able to add members if i tried to run application with multiple ports. Now the same is deployed in OCP (OpenShift) with 2 instance and hazelcast members are not added to each other due to this cache is not updated across the pod. below is the config code which i used for hazelcast.

 @Bean
    public Config hazelcastConfig(){
       return new Config().setInstanceName("hazelcast-instance")
                .addMapConfig(new MapConfig().setName("mycache")
                .setMaxSizeConfig(new MaxSizeConfig(300,MaxSizeConfig.MaxSizePolicy.FREE_HEAP_SIZE))
                .setEvictionPolicy(EvictionPolicy.LRU)
                .setTimeToLiveSeconds(2000));
    }

please let me know any additional configuration need to added, so that members can clustered in openshift

1

1 Answers

0
votes

Please read the following resorces:

This should solve all your issues. The simplest configuration you need to add (assuming you added the RBAC) is the following one:

config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);
config.getNetworkConfig().getJoin().getKubernetesConfig().setEnabled(true);