读书人

在同一台服务器中启动两个web服务实现

发布时间: 2012-03-13 11:21:11 作者: rapoo

在同一台服务器中启动两个web服务实现分布式,如何进行ehcache同步配置
我想在一台服务器中启动两个web服务实现分布式,并且实现ehcache的同步,


我用广播的形式配置好了ehcache的同步,并且在两台机器实现集群的状况下是没有问题的,
但是在一台机器中部署两个web服务无法同步了,可能是监听端口只能被一个web程序占用,所以无法实现同步

但是我看资料,好像是可以在一台机器内实现同步的

有没有人做过类似的配置啊,能说说怎么配置吗?


(下面是我现在的配置方式)


<?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" />

<cacheManagerPeerProviderFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
properties="peerDiscovery=automatic, multicastGroupAddress=233.4.5.6,
multicastGroupPort=4567, timeToLive=1"/>


<cacheManagerPeerListenerFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory" />

<defaultCache maxElementsInMemory="0" eternal="false" timeToIdleSeconds="1200"
memoryStoreEvictionPolicy="LRU" timeToLiveSeconds="1200">
<cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"/>
</defaultCache>

<cache name="sessionMap" maxElementsInMemory="1000"
eternal="true" timeToIdleSeconds="3600" timeToLiveSeconds="0" memoryStoreEvictionPolicy="LFU" >
<cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
properties="replicateAsynchronously=true, replicatePuts=true, replicatePutsViaCopy=true,
replicateUpdates=true, replicateUpdatesViaCopy=true, replicateRemovals=true" />
</cache>


</ehcache>


[解决办法]
你好楼主,
我这些天也在学习ehcache ,我是部署在两个不同的服务器上,然后用apache 集群,两个服务器的缓存不能同步,能不能把你的两个服务器的配置文件给我发下谢谢了
我的邮箱 707027084@qq.com

读书人网 >应用服务器

热点推荐