java - Ehcache RMI 复制仅以一种方式工作

标签 java rmi ehcache distributed-caching wildfly-8

我有一个 Jboss Wildfly 8.0.0 集群,有一个主服务器和一个从服务器。 Ehcache 配置为使用手动选项进行 RMI 复制。

问题是复制仅发生在一个方向。从主 Jboss 到从属 Jboss 的复制工作正常。 从属 Jboss 到主 JBoss 没有复制。

我使用 Jconsole 验证缓存详细信息,并且可以看到单向复制。我可以看到在主服务器和从服务器中都创建了缓存,问题是单向复制。

我的主Jboss位于VM Windows server 2012中,从属JBoss位于Windows 8.0桌面上 我在 JBoss 控制台中没有看到任何错误。

在Master ehcache.xml上:

<cacheManagerPeerProviderFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
properties="peerDiscovery=manual,
rmiUrls=//myslave:40002/userAddress"/>


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



<cache name="userAddress" eternal="true" overflowToDisk="true" maxEntriesLocalHeap="1" memoryStoreEvictionPolicy="LRU" >

        <cacheEventListenerFactory
        class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
        properties="replicateAsynchronously=true, replicatePuts=true, replicateUpdates=true,
        replicateUpdatesViaCopy=false, replicateRemovals=true "/>
</cache>

在从属 ehcache.xml 上:

<cacheManagerPeerProviderFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
properties="peerDiscovery=manual,
rmiUrls=//mymaster:40001/userAddress"/>

<cacheManagerPeerListenerFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
properties="port=40002,
socketTimeoutMillis=30000"/>



<cache name="userAddress" eternal="true" overflowToDisk="true" maxEntriesLocalHeap="1" memoryStoreEvictionPolicy="LRU" >

        <cacheEventListenerFactory
        class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
        properties="replicateAsynchronously=true, replicatePuts=true, replicateUpdates=true,
        replicateUpdatesViaCopy=false, replicateRemovals=true "/>

</cache>

最佳答案

主 JBoss 服务器上的防火墙阻止了到主服务器的复制。问题已解决。 值得一读this article在类似的情况下,它提供了有关“remoteObjectPort”的更多想法。

关于java - Ehcache RMI 复制仅以一种方式工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26736805/

相关文章:

java - 具有循环消息传递的简单客户端服务器

java - 写入 CSV 文件导致 JVM 崩溃

java - System.currentTimeMillis() 的减法

java - 如何通过LipeRMI传输图像(Blob)?

java - RMI 服务器与 RMI 注册表

java - 使用Java RMI,序列化对象到底什么时候通过网络传输?

java - EhCache:缓存架构

java - 了解构建器/工厂模式

java - Spring 4.2 中 EhCacheManager 出现类未找到异常

java - 如何在基于spring java的配置中设置ehcache.xml的位置?