经过上篇 coherence初识 ,最近算是和coherence杠上了,针对coherence3.5.3这个版本,把学到的东西整理下

1. 这个jar包有点大,4M多,首先打开coherence.jar,可以发现里面有许多的配置xml文件,就从这些xml说起

默认的配置文件包含下面文件:
  • tangosol-coherence.xml---提供了operational 和run-time设置,用来创建和配置cluster,通讯和数据管理服务。这个文件通常被称为operational deployment descriptor。
  1. <coherence xml-override="{tangosol.coherence.override /tangosol-coherence-override-{mode}.xml}">
    。。。。
  2. </coherence>
  • tangosol-coherence-override-dev.xml---当Coherence启动在dev模式时,这个文件覆盖了tangosol-coherence.xml文件的operational 设置。Coherence启动默认是dev 模式,这个文件中的设置会被使用。

    1. <coherence xml-override="/tangosol-coherence-override.xml">
      。。。。
    2. </coherence>
  • tangosol-coherence-override-eval.xml---当Coherence启动在eval模式时,这个文件覆盖了在tangosol-coherence.xml文件的operational 设置。
    1. <coherence xml-override="/tangosol-coherence-override.xml">
      。。。。
    2. </coherence>
  • tangosol-coherence-override-prod.xml---当Coherence启动在prod模式时,这个文件覆盖了在tangosol-coherence.xml文件的operational 设置。
    1. <coherence xml-override="/tangosol-coherence-override.xml">
      。。。。
    2. </coherence>

默认,使用tangosol-coherence-override.xml这个文件覆盖jar包中的配置,我们可以在自己的项目中加一个tangosol-coherence-override.xml,然后将它加入到classpath中,也可以设置tangosol.coherence.override系统参数指定xml文件,使用coherence不可避免要用集群,以上就是集群的相关配置文件

  • coherence-cache-config.xml---定义在cluster中使用的缓存名称、策略等,我们可以在classpath中添加coherence-cache-config.xml,或者在tangosol-coherence-override.xml中配置

    1. <configurable-cache-factory-config>
    2. <class-name>com.tangosol.net.DefaultConfigurableCacheFactory</class-name>
    3. <init-params>
    4. <init-param>
    5. <param-type>java.lang.String</param-type>
    6. <param-value system-property="tangosol.coherence.cacheconfig">coherence-cache-my.xml</param-value>
    7. </init-param>
    8. </init-params>
    9. </configurable-cache-factory-config>

    或者,设置tangosol.coherence.cacheconfig系统参数指定配置

  • coherence-pof-config.xml---我们可以在classpath中添加coherence-pof-config.xml,或者设置tangosol.pof.config系统参数指定配置
  • Management configuration files 一个用来配置coherence management reports的文件集合。这些文件在coherence.jar库的/reports目录里。文件包含了一组配置文件的报 告(report-group.xml。默认的),参考了许多的报告定义文件。 每个报告定义文件的结果是创建一个报告文件,该文件显示管理信息基于特定的一组度量。

2. 配置集群

在tangosol-coherence-override.xml中简单配置集群名称,成员名称,组播/单播地址,缓存配置等:

  1. <coherence>
  2. <cluster-config>
  3. <member-identity>
  4. <cluster-name system-property="tangosol.coherence.cluster">ProductClusterV3</cluster-name> <!--集群名称-->
  5. <member-name system-property="tangosol.coherence.member">ctas-node</member-name> <!--成员节点名称-->
  6. </member-identity>

  7. <!--单播-->
  8. <unicast-listener>
  9. <well-known-addresses>
  10. <socket-address id="1">
  11. <address system-property="tangosol.coherence.wka">10.6.53.83</address>
  12. <port system-property="tangosol.coherence.wka.port">23401</port>
  13. </socket-address>
  14. <socket-address id="2">
  15. <address system-property="tangosol.coherence.wka">10.6.53.83</address>
  16. <port system-property="tangosol.coherence.wka.port">23403</port>
  17. </socket-address>
  18. <socket-address id="3">
  19. <address system-property="tangosol.coherence.wka">10.6.53.84</address>
  20. <port system-property="tangosol.coherence.wka.port">23401</port>
  21. </socket-address>
  22. <socket-address id="4">
  23. <address system-property="tangosol.coherence.wka">10.6.53.84</address>
  24. <port system-property="tangosol.coherence.wka.port">23403</port>
  25. </socket-address>
  26. </well-known-addresses>
  27.  
  28. <!--<address system-property="tangosol.coherence.localhost">localhost</address>
  29. <port system-property="tangosol.coherence.localport">33414</port> -->
  30. </unicast-listener>

  31. <!--组播-->
  32. <multicast-listener>
  33. <address system-property="tangosol.coherence.clusteraddress">224.3.3.1</address>
  34. <port system-property="tangosol.coherence.clusterport">35301</port>
  35. <time-to-live system-property="tangosol.coherence.ttl">4</time-to-live>
  36. <join-timeout-milliseconds>10000</join-timeout-milliseconds>
  37. </multicast-listener>
  38. </cluster-config>
  39. <configurable-cache-factory-config>
  40. <class-name>com.tangosol.net.DefaultConfigurableCacheFactory</class-name>
  41. <init-params>
  42. <init-param>
  43. <param-type>java.lang.String</param-type>
  44. <param-value system-property="tangosol.coherence.cacheconfig">coherence-cache-config.xml</param-value> <!--缓存配置-->
  45. </init-param>
  46. </init-params>
  47. </configurable-cache-factory-config>
  48. </coherence>

单播要比组播的优先级高,一个集群应该保证名称,组播ip和端口一样,成员节点名称(member-name)可以一样,因为要确定一个节点还有好多其他信息(site-name、machine-name、process-name、role-name等)会默认设置的

实践证明:要想使用自定义配置文件,配置文件的classpath要优先于jar包,否则不会生效,千万注意

coherence配置说明的更多相关文章

  1. NHibernate之映射文件配置说明

    NHibernate之映射文件配置说明 1. hibernate-mapping 这个元素包括以下可选的属性.schema属性,指明了这个映射所引用的表所在的schema名称.假若指定了这个属性, 表 ...

  2. WCF服务器证书配置说明-没有能够进行密钥交换的私钥,或者进程可能没有访问私钥的权限

    WCF服务器证书配置说明 1.创建证书: makecert.exe -sr LocalMachine -ss My -a sha1 -n CN=XXX -sky exchange -pe 说明: -s ...

  3. Hardware Solutions CACHE COHERENCE AND THE MESI PROTOCOL

    COMPUTER ORGANIZATION AND ARCHITECTURE DESIGNING FOR PERFORMANCE NINTH EDITION Hardware-based soluti ...

  4. Software Solutions CACHE COHERENCE AND THE MESI PROTOCOL

    COMPUTER ORGANIZATION AND ARCHITECTURE DESIGNING FOR PERFORMANCE NINTH EDITION Software cache cohere ...

  5. CACHE COHERENCE AND THE MESI PROTOCOL

    COMPUTER ORGANIZATION AND ARCHITECTURE DESIGNING FOR PERFORMANCE NINTH EDITION In contemporary multi ...

  6. log4net一些配置说明

    <configuration> <configSections> <section name="log4net" type="System. ...

  7. maven -- 学习笔记(二)之setting.xml配置说明(备忘)

    setting.xml配置说明,learn from:http://pengqb.javaeye.com,http://blog.csdn.net/mypop/article/details/6146 ...

  8. Atitit.mybatis的测试  以及spring与mybatis在本项目中的集成配置说明

    Atitit.mybatis的测试  以及spring与mybatis在本项目中的集成配置说明 1.1. Mybatis invoke1 1.2. Spring的数据源配置2 1.3. Mybatis ...

  9. Oracle Coherence应用部署到Jboss EAP 6.x 时 NoClassDefFoundError: sun/rmi/server/MarshalOutputStream 的解决办法

    今天将一个web应用从weblogic 10.3迁移到jboss EAP 6.3上,该应用使用oracle coherence做为缓存,部署上去后,启动时一直报如下错误:     at java.ut ...

随机推荐

  1. js特效-仿照html属性title写一个弹出标题样式

    问题场景:商品描述,当营业员给客户介绍时会看着这些弹出标题来给客户讲解描述,一般采用html中属性title来实现,但是有些商品描述太长,这些title在IE浏览器中大约展示5s,营业员需要多次移动鼠 ...

  2. 【转】关于Xcode的Other Linker Flags

    链接器 首先,要说明一下Other Linker Flags到底是用来干嘛的.说白了,就是ld命令除了默认参数外的其他参数.ld命令实现的是链接器的工作,详细说明可以在终端man ld查看. 如果有人 ...

  3. thymeleaf条件表达式

    条件表达式形式:condition, then and else <tr th:class="${row.even}? 'even' : 'odd'"> ... < ...

  4. mongoDB在windows下基于配置文件的安装和权限配置方式

    下载mongoDB  http://www.mongodb.org/downloads 根据操作系统,选择需要下载的安装包 添加mongodb 安装目录 将解压的文件夹中内容拷贝,存放在想要安装的文件 ...

  5. HDU 3966 Aragorn's Story (树链点权剖分,成段修改单点查询)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3966 树链剖分的模版,成段更新单点查询.熟悉线段树的成段更新的话就小case啦. //树链剖分 边权修 ...

  6. hdu 4578 Transformation(线段树)

    线段树上的多操作... 题目大意: 树上 的初始值为0,然后有下列三种操作和求和. 1  x y c  在X-Y的之间全部加上C. 2  x y c  在X-Y的之间全部乘上C. 3  x y c   ...

  7. AngularJS~大话开篇

    AngularJS是一款优秀的前端JS框架,已经被用于Google的多款产品当中.AngularJS有着诸多特性,最为核心的是:MVVM.模块化.自动化双向数据绑定.语义化标签.依赖注入.等等. 前端 ...

  8. iOS开发-GCD和后台处理

    一些生命周期函数的调用时间 打开应用时,调用 applicationWillEnterForeground: applicationDidBecomeActive: 按Home键,调用 applica ...

  9. Hyper-V故障转移群集

    Hyper-V故障转移群集配置完成后,在故障转移群集管理器中新建虚机:角色-虚拟机-新建虚拟机 如果直接在Hyper-V管理器中新建虚机,则不是高可用,需要在故障转移群集管理器中将其添加进来使其成为高 ...

  10. SQL SERVER 设置自动备份和删除旧的数据库文件

    打开SQL SERVER MANAGEMENT STUDIO,启动SQL SERVER代理服务(注意在“控制面板-管理工具-服务”中设置SQL SERVER AGENT的启动类型为自动).启动后点击“ ...