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项目的页面缓存技术. 页面缓存是否有必要?. 这样说吧,几乎所有的网站的首页都是访问率最高的,而首页上的数 ...
随机推荐
- 转:Selenium中的几种等待方式,需特别注意implicitlyWait的用法
最近在项目过程中使用selenium 判断元素是否存在的时候 遇到一个很坑爹的问题, 用以下方法执行的时候每次都会等待很长一段时间,原因是因为对selenium实现方法了解不足导致一直找不到解决方法. ...
- 善用log日志
#-*- coding:utf-8 -*- import logging logger = logging.getLogger() #定义一个log日志对象 hdlr = logging.FileHa ...
- 通过onActivityResult()先跳转到联系人界面,然后把传回来的手机号显示到应用的EditText上
<pre name="code" class="plain"><pre name="code" class="p ...
- 【转】The magic behind array length property
Developer deals with arrays every day. Being a collection, an important property to query is the num ...
- Myeclipse8.5中svn插件安装方法总结
[转]http://lwcheng1985.iteye.com/blog/696143 有改动 方法一:在线安装 1.打开HELP->MyEclipse Configuration Cent ...
- (转)在Java中如何遍历Map对象
在Java中如何遍历Map对象 How to Iterate Over a Map in Java 在java中遍历Map有不少的方法.我们看一下最常用的方法及其优缺点. 既然java中的所有map都 ...
- 转:Web 测试的创作与调试技术
摘要:学习有关 Visual Studio 2005 Web 测试的更多知识,包括 Web 测试引擎和记录器如何工作,以及如何创建有效的 Web 测试. 本页内容 读者 简介 记录一个 Web 测试 ...
- boost锁的使用
boost锁的概述 boost库中提供了mutex类与lock类,通过组合可以轻易的构建读写锁与互斥锁. ▲ mutex对象类 mutex类提供互斥量,主要有两种:boost::mutex,b ...
- openjdk
apt-get install mercurial hg clone http://hg.openjdk.java.net/jdk8u/jdk8u20/ jdk8u20 ./get_source.sh
- IMapControl3 Interface(1) Properties属性
IMapControl3 Interface Provides access to members that control the MapControl. Note: the IMapControl ...