首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

Terracotta集群定做安装

2012-11-17 
Terracotta集群定制安装分布式Ehcache参考这个文档包括一个Terracotta分布cache的参考信息快速安装与定制

Terracotta集群定制安装

分布式Ehcache参考
这个文档包括一个Terracotta分布cache的参考信息

快速安装与定制安装

有2种方法来安装Terracotta分布cache:快速与定制。快速安装适用于只需要一个cache的集群。定制安装适用于需要一个cache集群和其他java对象,例如sessions和定制POJOs,或者使用Terracotta应用,或者使用Terracotta整合模块(Terracotta integration Modules:TIMs)整合其他技术。

如果你使用Ehcache在一个单独的JVM上,或者使用一个集群响应,可以考虑快速安装(在这里)。如果你是一个前沿的Terracotta使用者,而且想要添加一个分布caching,可以考虑使用定制安装。

如果你不确定用哪种方式安装,请阅读2中安装方法,然后找到适合你的安装方法。这2中安装方法不兼容,也不能被兼容使用。

分布式cache配置文件

Terracotta分布式配置文件(默认为ehcache.xml)包含一个CacheMananger(the Ehcache class managing a set of defined caches)的一个实例的配置。这个配置文件必须在你应用的classpath里面。当你使用WAR文件的时候,需要将ehcache.xml复制到WEB-INF/classes中。

Terracotta集群配置元素

<terracotta>
这个element是一个<cache>中可选的sub-element。在ehcache.xml中定义的每个<cache>中,<terracotta>可以做不同的设置。
<terracotta>有以下这些特性:
clusted - 开启("true")或者关闭("false")terracotta集群对于某个cache。
valueMode - 设置cache序列化的方式(the standard Ehcache "copy" cache)或者标识 (Terracotta object identity)。标识只能在定制安装中被使用(查看快速安装)
提示:比较序列化和标识模块

?
?<terracottaConfig>
?这个元素只在快速安装中使用(查看快速安装)。当Terracotta对于某个cache打开时,这个元素必须用url或者用一个内嵌配置,指明Terracotta配置文件(默认为tc-config.xml)。
?
?用URL属性
?为<terracottaConfig>元素添加一个URL属性:
?<terracottaConfig url="<source>" />
?<source>可以是以下几种方式:
?路径:(例如:url="/path/to/tc-config.xml")
?URL:(例如:url="http://www.mydomain.com/path/to/tc-config.xml)
?Terracotta主机地址:(例如:url="host1:9510")
?
?Note the following about using server addresses in the form <host>:<dso-port>:

??? * The default DSO port is 9510.??? * In a multi-server cluster, you can specify a comma-delimited list (for example, url="host1:9510,host2:9510,host3:9510" ).


内嵌Terracotta配置
你可以在ehcache.xml中内嵌一个关于Terracotta配置的内容:

?

?? ?
编辑不相容的配置
对于任何被集群的cache,你必须删除、disable、或者编辑那些在Terracotta集群时不相容的配置元素。被集群的caches有个<terracotta>或者<terracotta clustered=”true”>元素。
下面这些Ehcache配置属性或者元素需要删除或者disable。

?DiskStore-related attributes overflowToDisk and diskPersistent .

Terracotta 服务器自动提供一个磁盘储存。

? Replication-related configuration elements, such as <cacheManagerPeerProviderFactory>, <cacheManagerPeerListenerFactory>, <bootstrapCacheLoaderFactory>, <cacheEventListenerFactory>.

当一个变化发生在Terracotta集群的时候,所以包含变化元素和对象的节点都会更新。 Unlike the replication methods used to cluster Ehcache, cache event listeners are not (and do not need to be) notified of remote changes. Listeners are still aware of local changes.

?? Replication-related attributes such as replicateAsynchronously and replicatePuts .

MemoryStoreEvictionPolicy属性需要被设置成LFU或者LRU。设置MemoryStoreEvictionPolicy为FIFO将会引起IllegalArgumentException错误。

可以查看Ehcache documentation得到更多标准的配置关于Ehcache。

热点排行