首页 > 解决方案 > springboot中的Ehcache RMI复制不能双向工作

问题描述

我正在使用 ehcache 2.6.8 并在 spring 1.5 上运行。下面是我的 ehcache xml。我有两个节点,代码部署在 linux 框中的 tomcat 服务器中。

下面是我在我的应用程序中使用的 ehcache.xml。

<ehcache name="ehCacheConfig">

  <!--disk location where cache will be stored; currently default tmp file path   -->
    <diskStore path="java.io.tmpdir"/>
    <!-- cache manager peer provider -->
    <cacheManagerPeerProviderFactory
        class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
        properties="peerDiscovery=automatic, multicastGroupAddress=230.0.0.1, multicastGroupPort=4446, timeToLive=32" />
    <!-- cache manager peer Listener -->
    <cacheManagerPeerListenerFactory
        class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory" 
        properties="port=40001"/>

    <cache
        name="EmpCache"
        maxBytesLocalHeap="150M"
        memoryStoreEvictionPolicy="LFU"
        eternal="false"
        timeToIdleSeconds="3600"
        timeToLiveSeconds="3600"
        diskExpiryThreadIntervalSeconds="120"
        statistics="true"   >
    <persistence strategy="localTempSwap"/>
    <cacheEventListenerFactory
        class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
        properties="replicateAsynchronously=true, replicatePuts=true, replicateUpdates=true,
        replicateUpdatesViaCopy=true, replicateRemovals=true "/>
    </cache> 
</ehcache>

问题:数据正在从节点 1 复制到节点 2。但是当任何请求进入节点 2 并且数据被缓存时,它不会在节点 1 中被复制,如果我遗漏了什么,有人可以告诉我吗?

标签: ehcache

解决方案


已解决,问题是node1的host文件输入错误,node1的域名映射到127.0.0.1 IP。删除此错误条目后,它起作用了。


推荐阅读