简体   繁体   English

复制的 Ehcache 不工作

[英]Replicated Ehcache not working

I am trying to enable replecated ehcache and for some reason it does not seem to be working.我正在尝试启用 replecated ehcache,但由于某种原因,它似乎无法正常工作。

My ehcache.xml -我的 ehcache.xml -

    <?xml version="1.0" encoding="UTF-8"?> 

<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="ehcache.xsd"
         updateCheck="true" monitoring="autodetect"
         dynamicConfig="true"> 

    <diskStore path="java.io.tmpdir"/> 

    <transactionManagerLookup class="net.sf.ehcache.transaction.manager.DefaultTransactionManagerLookup"
                              properties="jndiName=java:/TransactionManager" propertySeparator=";"/> 
    <cacheManagerEventListenerFactory class="com.adobe_services.cache.SampleCacheManagerEventListenerFactory" properties="type=counting"/>
  <cacheManagerPeerProviderFactory
            class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
            properties="peerDiscovery=automatic,
                        multicastGroupAddress=230.0.0.1,
                        multicastGroupPort=4446, timeToLive=1"
            propertySeparator=","
            />
    <cacheManagerPeerListenerFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
                                     properties="hostName=, port=, socketTimeoutMillis="/> 
     <defaultCache
            maxElementsInMemory="10000"
            eternal="false"
            timeToIdleSeconds="120"
            timeToLiveSeconds="120"
            overflowToDisk="true"
            diskSpoolBufferSizeMB="30"
            maxElementsOnDisk="10000000"
            diskPersistent="false"
            diskExpiryThreadIntervalSeconds="120"
            memoryStoreEvictionPolicy="LRU"
            statistics="false"
            />

    <cache name="replicatedCache"
    maxElementsInMemory="5"
           maxElementsOnDisk="100000"
           eternal="true"
           overflowToDisk="true"
           diskPersistent="true"
           diskSpoolBufferSizeMB="20"
           timeToIdleSeconds="3600"
           timeToLiveSeconds="3600"
           memoryStoreEvictionPolicy="LFU"
           transactionalMode="off">
        <cacheEventListenerFactory
                class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"/>
        <bootstrapCacheLoaderFactory
        class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"
        properties="bootstrapAsynchronously=false, maximumChunkSizeBytes=5000000"
        propertySeparator="," />
    </cache>   

</ehcache> 

When i insert a value in one cache and then extract it in another clustered instance i am not able to get the object.当我在一个缓存中插入一个值,然后在另一个集群实例中提取它时,我无法获得 object。 I am using tomcat clustering on the same machine.我在同一台机器上使用 tomcat 集群。

Not sure what is wrong.不知道出了什么问题。

I notice your cacheManagerPeerListenerFactory RMICacheManagerPeerListenerFactory properties are blank, ie properties="hostName=, port=, socketTimeoutMillis=" .我注意到您的 cacheManagerPeerListenerFactory RMICacheManagerPeerListenerFactory 属性为空白,即properties="hostName=, port=, socketTimeoutMillis="

Try filling them out with the appropriate server instance settings and see if that works.尝试使用适当的服务器实例设置填写它们,看看是否可行。 This situation noted here may be similar to what you are experiencing.此处提到的这种情况可能与您遇到的情况相似。

If you are testing EhCache locally, try:如果您在本地测试 EhCache,请尝试:

multicastGroupAddress=127.0.0.1

But when you will switch to true network environment, use 230.0.0.1 again.但是当你要切换到真正的网络环境时,再次使用230.0.0.1 I assume 230.0.0.1 is your primary network interface broadcast address as returned by ifconfig Bcast value.我假设230.0.0.1ifconfig Bcast值返回的主网络接口广播地址。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM