ehcache不复制-(解决方案) [英] Ehcache not replicating - (solution)

查看:87
本文介绍了ehcache不复制-(解决方案)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将这个问题发给有类似问题的任何人。



信息:运行linux(ubuntu),x64,最新的Java版本(1.7.25) ,最新的tomcat(7.40)。



我在本地设置了两个apache tomcat,并且在两个tomcat上都设置了相同的webapp,以测试ehcache的某些功能以及已复制的缓存以及所有很好。



一旦我用第二个tomcat实例设置了专用服务器,EhCache便不会在我的PC和服务器之间复制(仍处于测试阶段)。



所有配置基本相同,当然IP地址也不相同。
因为我没有使用DNS中服务器和计算机的主机名,所以我在PC和服务器上的/ etc / hosts-file中都添加了主机名-认为这样就足够了。 p>

经过几个小时的仇恨-磨牙-我决定删除所有添加到/ etc / hosts的条目,而改用我们DNS中无聊的主机名公司(pc-103-15-87.xxxxx.com和pc-104-15-87.xxxxx.com),然后一切正常。



运行 wireshark在获得解决方案之前,它告诉我两个ehcache实例都在聊天,但是在两个ehcache实例之间的通信中提及了ip地址 127.0.0.1(可能用作某种回调地址)。



这导致我删除了在/ etc / hosts中添加的所有内容,并使用了DNS可解析的名称。现在, wireshark中的所有内容都向我显示了所有正确的ip地址,并且所有内容均为金。



希望这将对遇到类似问题的任何人有所帮助。



XML:



对等方的信息:

 < cacheManagerPeerProviderFactory 
class = net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory
properties = peerDiscovery = manual,
rmiUrls = // pc-103-15 -87.xxxxx.com:40002/persons|//pc-103-15-87.xxxxx.com:40002/wordCache\"/>

以及该服务器上的侦听器:

 < cacheManagerPeerListenerFactory 
class = net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory
properties = hostname = pc-104-15-87.xxxxx.com ,端口= 40002,socketTimeoutMillis = 3000 />


解决方案

解决方案是使用主机名组织的DNS,而不必依赖我在/ etc / hosts中的条目


Thought I'd let this out to anyone having similar problems.

Info: Running linux (ubuntu), x64, latest java-version (1.7.25), latest tomcat (7.40).

I had set up two apache tomcats locally, and the same webapp on both tomcats, to test some ehcache functionality and the cache replicated and all was great.

Once I set up a dedicated server with the second tomcat instance the EhCache didn't replicate between my PC and the server (still in the testing phase).

All the configs were basically the same without of course the ip-addresses being different. As I wasn't using the hostname of the server and computer from the DNS, i instead had added hostnames into the /etc/hosts-file on both the pc and the server - thinking this would be sufficient.

After a couple of hours being a hater - grinding my teeth - I decided to remove all added entries to /etc/hosts, and instead use the boring hostnames in the DNS of our company (pc-103-15-87.xxxxx.com and pc-104-15-87.xxxxx.com ) and then everything worked.

Running 'wireshark' before I had the solution it showed me that the both ehcache-instances were chatting, but the ip-address '127.0.0.1' (probably used as some sort of callback address), was "mentioned" in the communication between both ehcache instances.

This led me to remove everything I had added in /etc/hosts and use the DNS resolvable names. Now everything in 'wireshark' showed me all the correct ip-addresses and everything was gold.

Hope this will help anyone with a similar problem.

XML:

The info for the peer:

<cacheManagerPeerProviderFactory
    class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
    properties="peerDiscovery=manual,
    rmiUrls=//pc-103-15-87.xxxxx.com:40002/persons|//pc-103-15-87.xxxxx.com:40002/wordCache"/>

and the listener on this server:

<cacheManagerPeerListenerFactory 
    class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory" 
    properties="hostname=pc-104-15-87.xxxxx.com, port=40002, socketTimeoutMillis=3000"/>

解决方案

The solution was to use the hostnames that where in the DNS of the organization, and not rely on my own entries in /etc/hosts

这篇关于ehcache不复制-(解决方案)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆