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项目的页面缓存技术. 页面缓存是否有必要?. 这样说吧,几乎所有的网站的首页都是访问率最高的,而首页上的数 ...
随机推荐
- Codeforces 691B s-palindrome
水题. #pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> #includ ...
- Django源码解析
http://www.cnblogs.com/pythoner/archive/2011/07/30/2121599.html
- Android Studio的使用(十二)怎样打包项目
1.在导航栏的Build下面找到Generate Signed APK...,进入该菜单栏即可. 2.生成Key Store安全钥匙和证书的管理工具. 3.如果已经有了Key Store证书,则可以直 ...
- Web跨浏览器进程通信(Web跨域)
Web跨域已是老生常谈的话题,这次来尝试下跨域浏览器进程之间的通信 —— 这在过去基本依靠网络中转实现 在之前一篇文章里尝试了跨浏览器的数据共享,最后提到使用LocalConnection还可以实 ...
- UVA699 dfs and map
和书上的方法不一样... 因为我不知道节点,所以就直接用map来存左右了. #include<bits/stdc++.h> using namespace std; map <int ...
- map map
下面的无法运行. @Override protected void map(LongWritable key, Text value, Mapper<LongWritable, Text, Te ...
- 极光推送集成——iOS10 接受消息问题及解决
iOS10升级后极光推送发生了很大的变化,要求Xcode更新到8.0及以上版本才可以实现iOS10接受消息的方法 常见错误 这个问题困扰了我一天,辛亏好友盼神帮我解决,在此再次感谢盼神.一下是解决办法 ...
- C# devExpress BandedGridView属性 备忘
BandedGridView属性备忘 StringBuilder sb = new StringBuilder(); DevExpress.XtraGrid.Views.BandedGrid.Band ...
- ecma6的学习好网站
http://www.nodeclass.com/api/ECMAScript6.html#function http://es6.ruanyifeng.com/#docs/destructuring ...
- dashboard项目心得:
DAO类实现查找数据并放入一个map public Map<String,Integer> getAllBlock_multi(String projectname){ LinkedHas ...