ehcache版本2.8.3已在spring-boot中使用。 要测试的服务器是基于Linux的服务器A和服务器B 三种缓存 下面是ehcache.xml配置。
<ehcache>
<diskStore path="java.io.tmpdir" />
<cacheManagerPeerProviderFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
properties="peerDiscovery=automatic, multicastGroupAddress=230.0.0.1, multicastGroupPort=40001,
timeToLive=1 ,replicatePuts=true,replicatePutsViaCopy=true ,replicateUpdates=true ,replicateUpdatesViaCopy=false,
replicateRemovals=true ,replicateAsynchronously=false"/>
<cacheManagerPeerListenerFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
properties="socketTimeoutMillis=2000, port=40001"/>
<cache name="aCache"
maxElementsInMemory="0"
eternal="true"
timeToIdleSeconds="0"
timeToLiveSeconds="0"
overflowToDisk="false">
<cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"/>
<bootstrapCacheLoaderFactory
class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"
properties="bootstrapAsynchronously=true"
propertySeparator="," />
<!-- <cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
properties="replicateAsynchronously=true, replicatePuts=true, replicateUpdates=true,
replicateUpdatesViaCopy=false, replicateRemovals=true"/> -->
</cache>
<cache name="bCache"
maxElementsInMemory="0"
eternal="true"
timeToIdleSeconds="0"
timeToLiveSeconds="0"
overflowToDisk="false">
<cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"/>
<bootstrapCacheLoaderFactory
class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"
properties="bootstrapAsynchronously=true"
propertySeparator="," />
</cache>
<cache name="cCache"
maxElementsInMemory="0"
eternal="true"
timeToIdleSeconds="0"
timeToLiveSeconds="0"
overflowToDisk="false">
<cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"/>
<bootstrapCacheLoaderFactory
class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"
properties="bootstrapAsynchronously=true"
propertySeparator="," />
</cache>
</ehcache>
使用相同的设置输入服务器A和服务器B上的Ehcache.xml。 在服务器A上添加缓存时,我想查看在服务器B上添加的缓存
仅显示以下日志,但是服务器B无法检查添加的缓存。
[多播心跳接收器线程]调试n.s.e.d. MulticastKeepaliveHeartbeatReceiver-收到rmiUrls //192.168.10.20:40001/aCache|//192.168.10.20:40001/bCache|//192.168.10.20:40001/cCache
如果您知道如何,请告诉我。