java - 设置 ehcache 复制 - 我需要什么多播设置?

标签 java ehcache multicast

我正在尝试按照此处的说明设置 ehcache 复制:http://ehcache.sourceforge.net/EhcacheUserGuide.html#id.s22.2
这是在 Windows 机器上运行的,但最终将在生产环境中运行在 Solaris 上。

说明说要按如下方式设置提供者:

 <cacheManagerPeerProviderFactory
     class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
     properties="peerDiscovery=automatic, multicastGroupAddress=230.0.0.1,
     multicastGroupPort=4446, timeToLive=32"/>

像这样的监听器:

<cacheManagerPeerListenerFactory
    class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
    properties="hostName=localhost, port=40001,
    socketTimeoutMillis=2000"/>

我的问题是:
多播 IP 地址和端口是否任意(我知道地址必须在特定范围内,但它们是否必须是特定数字)?
它们是否需要由我们的系统管理员以某种方式设置(我在办公室网络上)?

我想在本地测试它,所以我使用上述配置运行两个单独的 tomcat 实例。 每一个我需要改变什么?我知道两个监听器不能在同一个端口上监听 - 但是提供者呢?
另外,监听器端口也是任意的吗?

我已尝试按上述方式进行设置,但在我的测试中,缓存似乎没有被复制——添加到一个 tomcat 缓存中的值在另一个缓存中不存在。
我可以做些什么来调试这种情况(除了数据包嗅探)?

在此先感谢您的帮助,因为这件事让我焦头烂额!

最佳答案

I want to test it locally so am running two separate tomcat instances with the above config.

因为我刚刚提交了关于 cherouvims 的答案 related question我也想在这里强调,他们实际上提供了一个至少做类似事情的示例(每个主机有多个节点,尽管只有一个实例):请参阅 RMI Distributed Caching 中的完整示例部分文档。

更改每个 cacheManagerPeerListenerFactory 的 TCP 端口确实很重要,但是多播设置可以(我认为它们必须)保持不变:您可以在 ehcache.xml's 中看到这个操作对于上面提到的完整示例:端口号从每个节点的 40001 逐一增加到 40006,同时多播设置保持不变。

如果您遵守了这一点,您的问题可能只是与在 Windows 上运行的 Tomcat 有关 - 请参阅 RMI Distributed Caching常见问题部分中的相关段落。 :

There is a bug in Tomcat and/or the JDK where any RMI listener will fail to start on Tomcat if the installation path has spaces in it.
[...]
As the default on Windows is to install Tomcat in "Program Files", this issue will occur by default.

关于java - 设置 ehcache 复制 - 我需要什么多播设置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/884760/

相关文章:

java - 安全聊天应用程序 + GUI

c - 接收每个组播数据包两次 Onload?

java - OneToOne双向映射外键自动填充

java - 获取对 JCA 适配器内的 EJB3 本地业务接口(interface)的引用

java - Hibernate n+1 select 具有多个表层次结构

playframework - 如何使用 Play 1.2.4 指定 Ehcache 设置

java - Hibernate二级缓存进阶知识

Ehcache & 多线程 : how to lock when inserting to the cache?

linux - 如何在 Haskell 中为多播套接字指定本地绑定(bind)接口(interface)?

ffmpeg - 使用 FFMPEG 从 UDP Multicast MPEG TS 流重新编码 AUDIO 的奇怪问题