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

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

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

    <coherence xml-override="/tangosol-coherence-override.xml">
    。。。。
    </coherence>
  • tangosol-coherence-override-eval.xml---当Coherence启动在eval模式时,这个文件覆盖了在tangosol-coherence.xml文件的operational 设置。
    <coherence xml-override="/tangosol-coherence-override.xml">
    。。。。
    </coherence>
  • tangosol-coherence-override-prod.xml---当Coherence启动在prod模式时,这个文件覆盖了在tangosol-coherence.xml文件的operational 设置。
    <coherence xml-override="/tangosol-coherence-override.xml">
    。。。。
    </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中配置

    <configurable-cache-factory-config>
    <class-name>com.tangosol.net.DefaultConfigurableCacheFactory</class-name>
    <init-params>
    <init-param>
    <param-type>java.lang.String</param-type>
    <param-value system-property="tangosol.coherence.cacheconfig">coherence-cache-my.xml</param-value>
    </init-param>
    </init-params>
    </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中简单配置集群名称,成员名称,组播/单播地址,缓存配置等:

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

<!--单播-->
<unicast-listener>
<well-known-addresses>
<socket-address id="1">
<address system-property="tangosol.coherence.wka">10.6.53.83</address>
<port system-property="tangosol.coherence.wka.port">23401</port>
</socket-address>
<socket-address id="2">
<address system-property="tangosol.coherence.wka">10.6.53.83</address>
<port system-property="tangosol.coherence.wka.port">23403</port>
</socket-address>
<socket-address id="3">
<address system-property="tangosol.coherence.wka">10.6.53.84</address>
<port system-property="tangosol.coherence.wka.port">23401</port>
</socket-address>
<socket-address id="4">
<address system-property="tangosol.coherence.wka">10.6.53.84</address>
<port system-property="tangosol.coherence.wka.port">23403</port>
</socket-address>
</well-known-addresses> <!--<address system-property="tangosol.coherence.localhost">localhost</address>
<port system-property="tangosol.coherence.localport">33414</port> -->
</unicast-listener>

<!--组播-->
<multicast-listener>
<address system-property="tangosol.coherence.clusteraddress">224.3.3.1</address>
<port system-property="tangosol.coherence.clusterport">35301</port>
<time-to-live system-property="tangosol.coherence.ttl">4</time-to-live>
<join-timeout-milliseconds>10000</join-timeout-milliseconds>
</multicast-listener>
</cluster-config>
<configurable-cache-factory-config>
<class-name>com.tangosol.net.DefaultConfigurableCacheFactory</class-name>
<init-params>
<init-param>
<param-type>java.lang.String</param-type>
<param-value system-property="tangosol.coherence.cacheconfig">coherence-cache-config.xml</param-value> <!--缓存配置-->
</init-param>
</init-params>
</configurable-cache-factory-config>
</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. 第二百六十四天 how can I 坚持

    现在上班闲的有点蛋疼,感觉没什么事,学不到什么东西. 到底要不要买房啊.也想买啊.愁人. 这辈子绝不会就这样. 睡觉.

  2. Cannot retrieve metalink for repository: epel. Please verify its path and try again

    今天在测试环境使用yum安装,遇到一个问题: Error: Cannot retrieve metalink for repository: epel. Please verify its path ...

  3. [转]JSON.stringify 语法实例讲解

    原文地址:http://www.jb51.net/article/29893.htm 作用:这个函数的作用主要是为了系列化对象的. 可能有些人对系列化这个词过敏,我的理解很简单.就是说把原来是对象的类 ...

  4. 表与表 不同条件下的关联SQL

    USE [ChiefMes]GO /****** Object: StoredProcedure [dbo].[Kenta_RptEmpOEE] Script Date: 05/12/2015 13: ...

  5. SessionFactory、HibernateTemplate、HibernateDaoSupport之间的关系说明

    在接触HibernateTemplate之前,我们知道,在对数据库进行CRUD操作之前,需要开启session.transaction等等.在hibernate学习过程中,我们知道了,得到sessio ...

  6. 关于android 将对象写入文件以及从文件读取对象

    由于项目需求,需要保存用户登录过的一些配置,当下次登录的时候读取登录过的配置,所以简单的SharePreferences没有办法满足,于是找到了Java中ObjectInputStream 与 Obj ...

  7. Quart 2D 绘制图形简单总结

    0  CGContextRef context = UIGraphicsGetCurrentContext(); 设置上下文 1 CGContextMoveToPoint 开始画线 2 CGConte ...

  8. 数据恢复软件使用经验-支持U盘,手机SD卡,硬盘数据,解决图片恢复后打不开的问题

    数据恢复软件使用经验-支持U盘,手机SD卡,硬盘数据.解决图片恢复后打不开的问题. 用过非常多数据恢复软件.最早EasyRecovery pro.恢复过U盘.手机SD卡,硬盘数据.但如今下载不了最新版 ...

  9. F5 负载均衡

    http://xjsunjie.blog.51cto.com/blog/999372/697285 http://www.eimhe.com/thread-142659-1-1.html

  10. Cordova 3.0 Plugin 安装 及"git" command line tool is not installed

    根据http://docs.phonegap.com/en/edge/guide_cli_index.md.html#The%20Command-line%20Interface Windows命令行 ...