当前位置: 代码迷 >> J2SE >> ehcache分布式缓存有关问题!求高手赐教~
  详细解决方案

ehcache分布式缓存有关问题!求高手赐教~

热度:1285   发布时间:2013-02-25 00:00:00.0
ehcache分布式缓存问题!求高手赐教~。。。!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
现在要做一个ehcache的分布式缓存,两台物理机server1 server2 我在server1里put一个对象 在server2中取不到!
server1 的ehcache.xml
XML code
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd">   <diskStore path="C:/ehcache/session"/>   <!--调用ehcache2的RMI-->   <cacheManagerPeerProviderFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"    properties="peerDiscovery=manual,rmiUrls=//192.168.1.2:40002/userIdcache "/><!--RMI监听40001端口-->    <cacheManagerPeerListenerFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"        properties="hostName=192.168.1.1,port=40001,socketTimeoutMillis=2000"/>            <defaultCache maxElementsInMemory="10000" eternal="false" timeToIdleSeconds="120" timeToLiveSeconds="120" overflowToDisk="true" diskSpoolBufferSizeMB="30" maxElementsOnDisk="10000000" diskPersistent="false" diskExpiryThreadIntervalSeconds="120" memoryStoreEvictionPolicy="LRU">    </defaultCache>        <cache name="userIdcache "        maxElementsInMemory="10000" eternal="false" timeToIdleSeconds="1800" timeToLiveSeconds="0"        overflowToDisk="false" diskSpoolBufferSizeMB="30" maxElementsOnDisk="10000000" diskPersistent="true"        diskExpiryThreadIntervalSeconds="120" memoryStoreEvictionPolicy="LRU">       <!--监听配置-->        <cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"            properties="replicateAsynchronously=true, replicatePuts=true, replicateUpdates=true,replicateUpdatesViaCopy= false, replicateRemovals= true " />    </cache></ehcache>

server2的ehcache.xml

XML code
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd">   <diskStore path="C:/ehcache/session"/>   <!--调用ehcache1的RMI-->   <cacheManagerPeerProviderFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"    properties="peerDiscovery=manual,rmiUrls=//192.168.1.1:40001/userIdcache "/><!--RMI监听40002端口-->    <cacheManagerPeerListenerFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"        properties="hostName=192.168.1.2,port=40002,socketTimeoutMillis=2000"/>            <defaultCache maxElementsInMemory="10000" eternal="false" timeToIdleSeconds="120" timeToLiveSeconds="120" overflowToDisk="true" diskSpoolBufferSizeMB="30" maxElementsOnDisk="10000000" diskPersistent="false" diskExpiryThreadIntervalSeconds="120" memoryStoreEvictionPolicy="LRU">    </defaultCache>        <cache name="userIdcache "        maxElementsInMemory="10000" eternal="false" timeToIdleSeconds="1800" timeToLiveSeconds="0"        overflowToDisk="false" diskSpoolBufferSizeMB="30" maxElementsOnDisk="10000000" diskPersistent="true"        diskExpiryThreadIntervalSeconds="120" memoryStoreEvictionPolicy="LRU">       <!--监听配置-->        <cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"            properties="replicateAsynchronously=true, replicatePuts=true, replicateUpdates=true,replicateUpdatesViaCopy= false, replicateRemovals= true " />    </cache></ehcache>
  相关解决方案