xjava
xjava

Reputation: 33

Avoid Hazelcast clustering

I have 5 Hazelcast cache instances with different instance and cache names in the same JVM. On application startup all of them form a cluster that I want to avoid as each has different data set. Following is the code which creates each instance with different name.

Config cfg = new Config(); 
Properties props = getHazelcastProps(); 
cfg.setProperties(props);
cfg.setInstanceName(getCacheInstanceName());
HazelcastInstance instance = Hazelcast.newHazelcastInstance(cfg);

Following is the hazelcast log

Aug 30, 2017 9:49:52 AM com.hazelcast.cluster.ClusterService
INFO: [MY-IP-ADDRESS]:5705 [dev] [3.2] 

Members [5] {
        Member [MY-IP-ADDRESS]:5701
        Member [MY-IP-ADDRESS]:5702
        Member [MY-IP-ADDRESS]:5703
        Member [MY-IP-ADDRESS]:5704
        Member [MY-IP-ADDRESS]:5705 this
}

How can I avoid clustering in this case?

Upvotes: 0

Views: 347

Answers (1)

noctarius
noctarius

Reputation: 6094

I don't think it makes sense to have one HazelcastInstance per cache, as Hazelcast has plenty of overhead (at least on the nodes), however, you can make sure they won't join by giving them different groupnames.

Upvotes: 2

Related Questions