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项目的页面缓存技术. 页面缓存是否有必要?. 这样说吧,几乎所有的网站的首页都是访问率最高的,而首页上的数 ...
随机推荐
- linux下执行scrapy的爬虫定时任务
刚开始执行scrapy crawl zentaos可以完成扫描 但是通过linux的crontab任务,只执行了连接mongodb的操作,并创建了索引 也就是说scrapy crawl zentaos ...
- PVST+(每个VLAN 的生成树PVST 加)
PVST+(每个VLAN 的生成树PVST 加) 实验拓扑: 分别在 SW1 和SW2 上show spanning-tree 查看结果: SW1#show spanning-tree VLAN000 ...
- C#编写Windows服务程序图文教程
安装服务程序C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe 要安装的服务程序路径(如F:\***.exe)卸载服务程序C: ...
- iOS中FMDB和GCD剖析
转载至:http://www.cocoachina.com/industry/20130819/6821.html 英文链接:https://github.com/ccgus/fmdb 由于FMDB是 ...
- zf-关于统计分析表单导出(写这个的 太麻烦了)
一个类里面写了2个一样的方法 如果是我 会重复利用 而不是这样写 今天改bug的时候我把一个类修改了2次 差点以为进错了类
- byte[]和InputStream的相互转换
1:byte[]转换为InputStream InputStream sbs = new ByteArrayInputStream(byte[] buf); 2:InputStream转换为Input ...
- 单词接龙(dragon)
单词接龙(dragon) 题目描述 单词接龙是一个与我们经常玩的成语接龙相类似的游戏,现在我们已知一组单词,且给定一个开头的字母,要求出以这个字母开头的最长的“龙”(每个单词都最多在“龙”中出现两次) ...
- js选择一个选项 跳出另一个选项 跳出一个输入框
跳出输入框 <script language="javascript"> function $(obj){return document.getElementById( ...
- Jfreet 自动删除生成的图片
jfreechart有自动删除的啊,会话失效就会自动删除的,我刚测试了啊,在web.xml里注册 <listener> <listener-class>org.jfree.ch ...
- 原创:LoadTest系列之Local.testtings之Web Test
在录制脚本后,需要对脚本进行回放,而在Loal.testting的Web Test设置中,可以设置脚本运行的次数,以及是否考虑think time等,如下图所示: 1. 双击Solution Item ...