Ehcache jgroups方式同步缓存出现问题总结
ehcache配置文件按官网配置如下:
<?xml version="1.0" encoding="UTF-8"?>
<ehcache> <diskStore path="java.io.tmpdir" /> <cacheManagerPeerProviderFactory
class="net.sf.ehcache.distribution.jgroups.JGroupsCacheManagerPeerProviderFactory"
properties="connect=TCP(start_port=7777):
TCPPING(initial_hosts=133.96.93.111[7777],133.96.93.105[7777];port_range=10;timeout=3000;
num_initial_members=3;up_thread=true;down_thread=true):
VERIFY_SUSPECT(timeout=1500;down_thread=false;up_thread=false):
pbcast.NAKACK(down_thread=true;up_thread=true;gc_lag=100;retransmit_timeout=3000):
pbcast.GMS(join_timeout=5000;join_retry_timeout=2000;shun=false;
print_local_addr=false;down_thread=true;up_thread=true)"
propertySeparator="::" /> <defaultCache maxElementsInMemory="10000" overflowToDisk="false"
eternal="false" memoryStoreEvictionPolicy="LRU"
maxElementsOnDisk="10000000" diskExpiryThreadIntervalSeconds="600"
timeToIdleSeconds="3600" timeToLiveSeconds="100000"
diskPersistent="false" /> <cache name="AutoAssignUsers" maxElementsInMemory="10000" eternal="true"
overflowToDisk="false" timeToIdleSeconds="1" timeToLiveSeconds="600"
memoryStoreEvictionPolicy="LRU">
<cacheEventListenerFactory
class="net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory"
properties="replicateAsynchronously=true, replicatePuts=true, replicateUpdates=true,
replicateUpdatesViaCopy=true, replicateRemovals=true "/>
</cache> </ehcache>
按官网配置后启动报错:
[net.sf.ehcache.distribution.jgroups.JGroupsCacheManagerPeerProvider] (main) Failed to create JGroups Channel, replication will not function. org.jgroups.ChannelException: unable to setup the protocol stack
at org.jgroups.JChannel.init(JChannel.java:1703)
at org.jgroups.JChannel.<init>(JChannel.java:246)
at org.jgroups.JChannel.<init>(JChannel.java:229)
at net.sf.ehcache.distribution.jgroups.JGroupsCacheManagerPeerProvider.init(JGroupsCacheManagerPeerProvider.java:127)
at net.sf.ehcache.CacheManager.init(CacheManager.java:328)
at net.sf.ehcache.CacheManager.<init>(CacheManager.java:226)
at net.sf.ehcache.CacheManager.create(CacheManager.java:690)
Caused by: java.lang.IllegalArgumentException: start_port cannot be set to 0, as no dynamic discovery protocol (e.g. MPING or TCPGOSSIP) has been detected.
at org.jgroups.protocols.BasicTCP.init(BasicTCP.java:90)
at org.jgroups.stack.ProtocolStack.initProtocolStack(ProtocolStack.java:705)
at org.jgroups.stack.ProtocolStack.setup(ProtocolStack.java:457)
at org.jgroups.JChannel.init(JChannel.java:1699)
之后google找到解决方法:
①将
start_port=7800 改为 bind_port=7800
即
<cacheManagerPeerProviderFactory
class="net.sf.ehcache.distribution.jgroups.JGroupsCacheManagerPeerProviderFactory"
properties="connect=TCP(bind_port=7777):
TCPPING(initial_hosts=133.96.93.111[7777],133.96.93.105[7777];port_range=10;timeout=3000;
num_initial_members=3;up_thread=true;down_thread=true):
VERIFY_SUSPECT(timeout=1500;down_thread=false;up_thread=false):
pbcast.NAKACK(down_thread=true;up_thread=true;gc_lag=100;retransmit_timeout=3000):
pbcast.GMS(join_timeout=5000;join_retry_timeout=2000;shun=false;
print_local_addr=false;down_thread=true;up_thread=true)"
propertySeparator="::" />
②cacheManagerPeerProviderFactory 中properties的属性改为文件引用如下:
<cacheManagerPeerProviderFactory
class="net.sf.ehcache.distribution.jgroups.JGroupsCacheManagerPeerProviderFactory"
properties="jgroups_tcp.xml" />
jgroups_tcp.xml :
<?xml version='1.0'?>
<config>
<TCP start_port="7777" />
<TCPPING timeout="3000"
initial_hosts="139.99.93.111[7777],139.99.93.105[7777]"
port_range="10"
num_initial_members="3"/>
<VERIFY_SUSPECT timeout="1500" />
<pbcast.NAKACK use_mcast_xmit="false" gc_lag="100"
retransmit_timeout="300,600,1200,2400,4800"
discard_delivered_msgs="true"/>
<pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000" max_bytes="400000"/>
<pbcast.GMS print_local_addr="true" join_timeout="5000" shun="false" view_bundling="true"/>
</config>
我试了第一种方法可以缓存同步,第二种没试,但是解决方法中有,可以试试
给出原地址:http://forums.terracotta.org/forums/posts/list/4660.page
Ehcache jgroups方式同步缓存出现问题总结的更多相关文章
- 本文分享一下ehcache的使用心得,本文主要讲以广播的形式同步缓存。
本文分享一下ehcache的使用心得,本文主要讲以广播的形式同步缓存. 下面讲述主要分为两个部分,一个是配置文件,一个是Java代码. 1.准备jar包: slf4j-api-1.7.12.jar,e ...
- EhCache+Redis实现分布式缓存
Ehcache集群模式 由于 EhCache 是进程中的缓存系统,一旦将应用部署在集群环境中,每一个节点维护各自的缓存数据,当某个节点对缓存数据进行更新,这些更新的数据无法在其它节点中共享,这不仅会降 ...
- 二)spring 集成 ehcache jgroups 集群
依赖 <dependency> <groupId>org.springframework</groupId> <artifactId>spring-co ...
- Spring+ehcache+redis两级缓存
问题描述 场景:我们的应用系统是分布式集群的,可横向扩展的.应用中某个接口操作满足以下一个或多个条件: 1. 接口运行复杂代价大, 2. 接口返回数据量大, 3. 接口的数据基本不会更改, 4. 接口 ...
- Springboot整合Ehcache 解决Mybatis二级缓存数据脏读 -详细
前面有写了一篇关于这个,但是这几天又改进了一点,就单独一篇在详细说明一下 配置 application.properties ,启用Ehcache # Ehcache缓存 spring.cache.t ...
- spring ehcache 页面、对象缓存
一.Ehcache基本用法 CacheManager cacheManager = CacheManager.create(); // 或者 cacheManager = CacheManager.g ...
- rsync 通过服务的方式同步 linux系统日志 screen工具
rsync 通过服务的方式同步 俩台机器传文件IP地址交叉编写. 主机1: 要编辑配置文件 /etc/rsyncd.conf rsyncd.conf样例 port=873 ...
- winscp以命令行方式同步服务器数据到PC机磁盘上
目前服务器上每日会产生备份文件,需要使用winscp工具把备份同步到本地PC机硬盘上.平时都是图形界面用鼠标点击方式来同步的,效率低下,因此编写了winscp自动同步脚本,并加入到计划任务中定时自动运 ...
- ehcache实现页面整体缓存和页面局部缓存
之前写过spring cache和ehcache的基本介绍和注解实现缓存管理,今天记录下web项目的页面缓存技术. 页面缓存是否有必要?. 这样说吧,几乎所有的网站的首页都是访问率最高的,而首页上的数 ...
随机推荐
- Bootstrap学习 - 组件
下拉菜单 注意:需要先引入jQuery.js再引入bootstrap.js(依赖前者) <div class="dropdown pull-right"> //默认就是 ...
- ListView random IndexOutOfBoundsException on Froyo
http://stackoverflow.com/questions/8431342/listview-random-indexoutofboundsexception-on-froyo 今天遇到个 ...
- ubuntu 下重装mysql若干问题
最近由于种种原因需要重装mysql.打开终端开始卸载 sudo apt-get remove mysql-comm sudo apt-get auto remove 重新开始安装mysql sudo ...
- hdu_5616_Jam's balance(暴力枚举子集||母函数)
题目连接:hdu_5616_Jam's balance 题意: 给你一些砝码,和一些要被称出的重量,如果这些砝码能称出来输出YES,否则输出NO 题解:我们想想,这题求组合方式,我们这里可以直接用母函 ...
- 浅谈Android五大布局
Android的界面是有布局和组件协同完成的,布局好比是建筑里的框架,而组件则相当于建筑里的砖瓦.组件按照布局的要求依次排列,就组成了用户所看见的界面.Android的五大布局分别是LinearLay ...
- 【记录】haphost免费vps初始配置
1.配置德国epel源 yum install yum-priorities rpm -Uvh http://ftp-stud.hs-esslingen.de/pub/epel/6/i386/epel ...
- (转)Eclipse中使用Ant
Eclipse中使用Ant 分类: JAVA 工具 服务器2014-08-05 09:59 5507人阅读 评论(0) 收藏 举报 anteclipse http://286.iteye.com/bl ...
- vc6 pbo 文件为空的解决方法
使用Profile调试vc6应用程序的性能时,将生成pbo文件,今天在vc IDE中增加了命令行启动参数,导致profile无法生成pbo文件,进而无法生成性能报告. 解决方法: 去掉IDE中的命令行 ...
- Dojo和jQuery区别
Dojo类似jQuery,且用法也差不多,但是Dojo属于重量级的框架,自带的表单验证,Grid,tree等控件. 在选择上,个人觉得轻量级的框架比较好,因为方便引入第三方的,有特色的库. 就像选择S ...
- Base64编码Java实现
一.什么是Base64编码 Base64是网络上最常见的用于传输8Bit字节代码的编码方式之一.Base64 主要不是加密,它主要的用途是把一些二进制数转成普通字符用于网络传输. 由于一些二进制字符在 ...