我们已经在 Linux 上的两个系统上安装了一个服务器的两个实例,这是一个 Web 应用程序,例如 SampleWebApp。我们已经配置了 ehcache 来缓存本地数据,还配置了一个默认的 RMI 复制来将在 Server1 上完成的更改复制到 Server2。复制在 Windows 环境下工作正常,但在 Linux 环境下不工作。即使没有打印错误,它也会默默地失败。
在 ehcache.xml 文件中完成的配置如下 -
<cacheManagerPeerProviderFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
properties="peerDiscovery=manual,
rmiUrls=//<ip>:50000/sampleReplicatedCache"
propertySeparator="," />
<cacheManagerPeerListenerFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory" properties="port=40000"/>
<cache name="cmServerReplicatedCache" maxElementsInMemory="100" eternal="true"
memoryStoreEvictionPolicy="LRU" >
<cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
properties="replicateAsynchronously=true, replicatePuts=true,
replicatePutsViaCopy=true, replicateUpdates=true, replicateUpdatesViaCopy=true, replicateRemovals=false, asynchronousReplicationIntervalMillis=5000"/>
<bootstrapCacheLoaderFactory class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"/>
</cache>
没有安装可以阻止复制的防火墙,因此防火墙不是它失败的原因。还检查端口是否打开。分配的端口 50000 被打开,Ehcache 监听这个端口。问题是如果缓存中有更新,则不会复制此更改。
对此的任何建议或澄清将不胜感激。
谢谢,奇迹!