Terracotta与EHcache集群

来源:互联网 发布:gta5 handling漂移数据 编辑:程序博客网 时间:2024/05/17 05:51

Terracotta与EHcache集群

发布日期:11-04-26 01:24    文章来源:互联网
的另一种为集群多种类型的数据如:Cache、POJO、Session等(官方称定制安装)。1.环境需求
●JDK1.5 或者更高
●Terracotta3.2 或者更高
●所有被集群的对象是可串行化(serializable)2.配置ehcache.xml
●将${TERRACOTTA_HOME}/distributed-cache/ehcache.xsd、
${TERRACOTTA_HOME}/distributed-cache/ehcache.xml复制到项目中的如:src下●将ehcache.xml配置文件的ehcache元素修改成:
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ehcache.xsd"
name="SSO4Cache" updateCheck="false" monitoring="autodetect"><defaultCache
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="120"
timeToLiveSeconds="120"
overflowToDisk="true"
diskSpoolBufferSizeMB="30"
maxElementsOnDisk="10000000"
diskPersistent="false"
diskExpiryThreadIntervalSeconds="120"
memoryStoreEvictionPolicy="LRU"
/><cache name="cn.com.commnet.cas.OBJECT_ECACHE"
maxElementsInMemory="1000"
eternal="false"
timeToIdleSeconds="300000"
timeToLiveSeconds="600000"
memoryStoreEvictionPolicy="LFU"
>
<terracotta clustered="true" valueMode="identity"/>
<!--表示该cache要加入到terracotta service中-->
</cache><cache name="cn.com.commnet.policyagent.GLOBAL_ECACHE"
maxElementsInMemory="1000"
eternal="false"
timeToIdleSeconds="300000"
timeToLiveSeconds="600000"
memoryStoreEvictionPolicy="LFU"
>
<terracotta clustered="true"/> <!--表示该cache要加入到terracotta service中-->
</cache>★valueMode 模式分两种1.serialization模式(默认)2.identity 模式(该模式只能在EHcache自定义安装下有效,快速安装下该模式无效)
1.serialization模式:在该模式下TC(terracotta Client)从TS(terracotta Service)缓存中获取一个元素得到了该元素的副本。所做的更改不影响元素在TS缓存或者其他TC元素副本。只有将在TS缓存中的元素覆盖其他TC也将更新。
2.identity 模式:TC从TS缓存中获取一个元素的引用。TC所做的更改将及时更新了每个TC节点上的元素引用。
★去除无效的 <terracottaConfig url="locahost:9510"/>、 <cacheManagerEventListenerFactory class="" properties=""/>、<diskStore path="java.io.tmpdir"/>3.修改tc-config.xml文件
<modules>
<module name="tim-ehcache-1.7"/> <!--增加-->
<module name="tim-tomcat-6.0"/>
<module name="tim-quartz-1.7"/>
</modules>
并复制到没一个TS、TC上,后面操作与《》一致
原创粉丝点击