JBoss企业级应用服务平台群集指南(十二)

2.2 JBoss缓存配置

    JBoss 缓存为 JBoss 集群提供分布式缓存和状态复制服务。一个 JBoss 集群可以持有若干 JBoss Cache MBeans ( TreeCache MBean 一样,被大家所熟悉 ), HTTP 会话复制一个 , 有状态会话 beans 一个 , cached 实体 beans 一个 , 等等 . 一个普通的 TreeCache MBean 配置被列出到下面的表格里。应用程序明确 TreeCache MBean 配置涵盖在后面的章节里,当这些应用程序被讨论的时候。
< mbean code="org.jboss.cache.TreeCach  
    name="jboss.cache:service=TreeCache " >  
     < depends >jboss:service=Naming </ depends >  
     < depends >jboss:service=TransactionManager </ depends >  
    <!-- Configure the TransactionManager -->  
     < attribute name ="TransactionManagerLookupClass" >  
  org.jboss.cache.DummyTransactionManagerLookup  
     </ attribute >  
    <!-- Node locking level : SERIALIZABLE;REPEATABLE_READ (default);READ_COMMITTED;READ_UNCOMMITTED;NONE -->  
     < attribute name ="IsolationLevel" >REPEATABLE_READ </ attribute >  
    <!--     Valid modes are LOCAL REPL_ASYNC REPL_SYNC -->  
     < attribute name ="CacheMode" >LOCAL </ attribute >  
    <!-- Name of cluster. Needs to be the same for all clusters, in order to find each other -->  
     < attribute name ="ClusterName" >TreeCache-Cluster </ attribute >  
    <!-- The max amount of time (in milliseconds) we wait until the initial state (ie. the contents of the cache) are  
  retrieved from existing members in a clustered environment-->  
     < attribute name ="InitialStateRetrievalTimeout" >5000 </ attribute >  
    <!-- Number of milliseconds to wait until all responses for a synchronous call have been received.-->  
     < attribute name ="SyncReplTimeout" >10000 </ attribute >  
    <!--     Max number of milliseconds to wait for a lock acquisition -->  
     < attribute name ="LockAcquisitionTimeout" >15000 </ attribute >  
    <!--     Name of the eviction policy class. -->  
     < attribute name ="EvictionPolicyClass" >  
  org.jboss.cache.eviction.LRUPolicy  
     </ attribute >  
    <!-- Specific eviction policy configurations. This is LRU -->  
     < attribute name ="EvictionPolicyConfig" >  
   < config >  
       < attribute name ="wakeUpIntervalSeconds" >5 </ attribute >

<!-- Cache wide default -->
   < region name ="/_default_" >
     < attribute name ="maxNodes" >5000 </ attribute >
     < attribute name ="timeToLiveSeconds" >1000 </ attribute >
   </ region >
   < region name ="/org/jboss/data" >
     < attribute name ="maxNodes" >5000 </ attribute >
     < attribute name ="timeToLiveSeconds" >1000 </ attribute >
   </ region >
   < region name ="/org/jboss/test/data" >
     < attribute name ="maxNodes" >5 </ attribute >
     < attribute name ="timeToLiveSeconds" >4 </ attribute >
   </ region >
   </ config >
</ attribute >
< attribute name ="CacheLoaderClass" >
  org.jboss.cache.loader.bdbje.BdbjeCacheLoader
</ attribute >
< attribute name ="CacheLoaderConfig" >location=c:\\tmp </ attribute >
< attribute name ="CacheLoaderShared" >true </ attribute >
< attribute name ="CacheLoaderPreload" >
  /a/b/c,/all/my/objects
</ attribute >
< attribute name ="CacheLoaderFetchTransientState" >false </ attribute >
< attribute name ="CacheLoaderFetchPersistentState" >true </ attribute >
< attribute name ="ClusterConfig" >
  ... JGroups config for the cluster ...
</ attribute >
</ mbean >
上面的列表中,省略了 JGroups 的配置元素 ( 例如 , ClusterConfig 属性 ). 在本章的前一节你可以学习到怎么配置 JGroups (Section 1, JGroups Configuration ). TreeCache MBean 使用下列属性。
  CacheLoaderClass 指定 CacheLoader 实现的完整的有效的类名 .
  CacheLoaderConfig 包含能自我配置的特殊的 CacheLoader 实现的 properties 列表。
  CacheLoaderFetchPersistentState 指定是否从其他节点获取持久化状态。这个持久华被获取仅仅在 CacheLoaderShared false 的时候 . 这个属性在 FetchStateOnStartup true 的时候被使用。
  CacheLoaderFetchTransientState 指定是否从其他节点获取内存中的状态。如果 FetchStateOnStartup true ,这个属性被使用 .
  CacheLoaderPreload 包含需要被预载的节点列表,节点之间用逗号分隔。
( 例如 , /aop, /productcatalogue).
  CacheLoaderShared 指定我们是否应该共享数据存储,或者每一个节点是否应该持有它的自己的本地数据存储。
  CacheMode 指定在集群结点之间怎么同步 cache 。这可能值包括 LOCAL, REPL_SYNC, or REPL_ASYNC.
  ClusterName 指定集群的名称,即哪个集群。这个值需要与在集群中所有节点的集群名字一样,这样才能使它们能够找到对方。
  ClusterConfig 定制( contains )根本的 JGroups 堆( underlying JGroups stack )的配置 (see Section 1, JGroups Configuration ).
  EvictionPolicyClass 指定实现了 EvictionPolicy 接口的类的名字。你可以使用 JBoss Cache 提供的 EvictionPolicy 类或者提供你自己 policy 实现。如果这个属性是空的 , 没有 eviction policy 被激活 .
  EvictionPolicyConfig 包含制定 eviction 政策的配置参数。注意这个内容是供应商特殊的。
  FetchStateOnStartup 指定从现有的成员中是否获得初始状态。它允许 warm/hot 缓存 (true/false). 这个可以由 CacheLoaderFetchTransientState CacheLoaderFetchPersistentState 进一步定义 .
  InitialStateRetrievalTimeout 指定重获初始状态等待的时间,单位是毫秒。
  IsolationLevel 指定节点锁定级别。可能的值包括 SERIALIZABLE,REPEATABLE_READ ( 默认的 ), READ_COMMITTED, READ_UNCOMMITTED, NONE.
  LockAcquisitionTimeout 指定等待一个锁定被获得的时间,单位是毫秒。
    如果一个锁定不能被获得,那么一个 exception 异常将被抛出( thrown )。
  ReplQueueInterval 指定元素从复制队列被复制的时间,单位是毫秒。
  SyncReplTimeout 指定直到复制 ACKs 已经被集群中的所有节点接收的等待时间,单位的毫秒。 这个属性仅仅用于同步复制方式 ( 例如 , CacheMode 属性是 REPL_SYNC).
  UseReplQueue 指定是否使用复制队列 (true/false). 这个属性仅仅应用于同步复制方式 ( 例如 ., CacheMode 属性是 REPL_ASYNC).
  ReplQueueMaxElements 指定知道开始复制时,在复制队列里元素的最大数量。
  TransactionManagerLookupClass 指定实现 TransactionManagerLookup 接口的类的完整有效的名字。在 JBoss AS 里面,事务管理的默认值是 JBossTransactionManagerLookup.
 
==========================================================
      到此,官方给出的这篇没有完结的《JBoss企业级应用服务平台群集指南》翻译就结束了。希望能对大家有所帮助。

你可能感兴趣的:(jboss,职场,休闲,群集)