Reputation: 2526
Now, I am working with spring mvc and hazel cast.
Everything is working well with my application.
For better performance, we would like to use caching method.
We can't use EhCache
because we have 2 application in same server with single database.
So, we shifted to Hazelcast
and we already configure and it is working.
We got what we want but the problem is hazelcast looking for other server and other server can join our server in caching process.
That is the problem.
We would like to use hazelcast for only one server and no incoming request and outgoing request to join on multicast.
We only want to share data only in our one server.
But we can't find the right configuration for it.
Our current config is as shown below:
In Java Config
Config config = new Config("instance");
NetworkConfig network = config.getNetworkConfig();
JoinConfig join = network.getJoin();
join.getMulticastConfig().setEnabled(false);
join.getTcpIpConfig().setEnabled(false);
In spring-application-context.xml
<cache:annotation-driven cache-manager="cacheManager" />
<bean id="cacheManager" class="com.hazelcast.spring.cache.HazelcastCacheManager">
<constructor-arg ref="instance"/>
</bean>
<hz:hazelcast id="instance">
<hz:config>
<hz:group name="dev" password="password"/>
</hz:config>
</hz:hazelcast>
Caching is working well with the above codes but it join multiple server.
Please, help me to configure it for only one server, no external join.
Thanks
Upvotes: 0
Views: 809
Reputation: 3150
Multicast is the only discovery mechanism enabled by default, so turning it off should be all that's required to stop this server joining others.
In spring-application-context.xml
try
<hz:hazelcast id="instance">
<hz:config>
<hz:group name="dev" password="password"/>
<hz:network port="5701" port-auto-increment="false">
<hz:join>
<hz:multicast enabled="false"/>
</hz:join>
</hz:network>
</hz:config>
</hz:hazelcast>
The Java config looks good too, but I don't see where it's used.
As proof also, change the group name to something other than "dev". "dev" is the default, so if you use a different name temporarily and you see the new name in the logs, you know your configuration is being used.
Upvotes: 1