Java – set ehcache replication – what multicast settings are required?

I am trying to set up ehcache replication as follows: http://ehcache.sourceforge.net/EhcacheUserGuide.html#id.s22.2

Set the provider as follows:

<cacheManagerPeerProviderFactory
     class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
     properties="peerDiscovery=automatic,multicastGroupAddress=230.0.0.1,multicastGroupPort=4446,timeToLive=32"/>

And an audience:

<cacheManagerPeerListenerFactory
    class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
    properties="hostName=localhost,port=40001,socketTimeoutMillis=2000"/>

My question is: is the multicast IP address and port arbitrary (I know that the address must take effect in a specific range, but do they have to be specific numbers)? Do you need our system administrator (I'm in the office network) to set it up in some way?

I want to test locally, so I run two separate Tomcat instances with the above configuration I need to change every one? I know listeners don't hear the same port - but what about the provider? Is the listener port also arbitrary?

I have tried to set it as above, but in my test, the cache does not seem to be copied - the value added in one Tomcat cache does not exist in another cache Is there anything you can do to debug this situation (except packet sniffing)?

Thank you in advance for any help that has been tearing my hair in this one!

Solution

Since I just submitted the answer to the cherouvims related question, I just want to emphasize this point. They actually provide an example to do at least some similar things (multiple nodes of each host, although there is only one instance): see the RMI distributed caching document

It is really important to change the TCP port of each cachemanagerpeerlistenerfactory, but the multicast settings can (I think they must) remain unchanged: you can The operation in the above complete example can be seen in XML's: the port number is increased by one, and each node is from 40001 to 40006, while the multicast setting remains unchanged

If you follow this, your problem may only be related to Tomcat running on windows – see the relevant paragraph in the frequently asked questions section in RMI distributed caching:

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>