Jboss多节点中的Infinispan分布式缓存通信问题

时间:2020-09-24 13:15:59

标签: caching jboss cluster-computing infinispan jgroups

我在以独立模式运行的不同VM上有多个Jboss节点。我正在使用分布式Infinispan缓存。 下面是我当前正在使用的代码。

JChannel jchannel = new JChannel();
jchannel.setDiscardOwnMessages(false);
jchannel.setName("losci_qa");
JGroupsTransport transport = new JGroupsTransport(jchannel);

manager = new DefaultCacheManager(GlobalConfigurationBuilder.defaultClusteredBuilder()
          .transport().transport(transport).nodeName(cacheClusterName+"-node").clusterName(cacheClusterName)
          .build());

ConfigurationBuilder c = new ConfigurationBuilder();
c.clustering().cacheMode(CacheMode.DIST_SYNC).hash().numOwners(numOwners).numSegments(numSegments).capacityFactor(capacityFactor).build();
c.invocationBatching().enable();
c.transaction().transactionMode(TransactionMode.TRANSACTIONAL).lockingMode(LockingMode.PESSIMISTIC);
manager.defineConfiguration(DIST, c.build());

以上代码在单个节点上成功运行。 问题是,当我想与两个节点通信此缓存时,它不起作用。当我在上面的代码中运行时,其打印在日志下方。

服务器1日志:

2020-09-24 12:16:45,637 INFO  [org.infinispan.factories.GlobalComponentRegistry] (default task-1) ISPN000128: Infinispan version: Infinispan 'Infinity Minus ONE +2' 9.4.11.Final
2020-09-24 12:16:45,823 INFO  [org.infinispan.remoting.transport.jgroups.JGroupsTransport] (default task-1) ISPN000078: Starting JGroups channel losci_qa
2020-09-24 12:16:45,839 INFO  [stdout] (default task-1)
2020-09-24 12:16:45,839 INFO  [stdout] (default task-1) -------------------------------------------------------------------
2020-09-24 12:16:45,840 INFO  [stdout] (default task-1) GMS: address=losci_qa, cluster=losci_qa, physical address=10.100.101.82:60774
2020-09-24 12:16:45,840 INFO  [stdout] (default task-1) -------------------------------------------------------------------
2020-09-24 12:16:47,845 INFO  [org.jgroups.protocols.pbcast.GMS] (default task-1) losci_qa: no members discovered after 2003 ms: creating cluster as first member
2020-09-24 12:16:47,858 INFO  [org.infinispan.CLUSTER] (default task-1) ISPN000094: Received new cluster view for channel losci_qa: [losci_qa|0] (1) [losci_qa]
2020-09-24 12:16:47,865 INFO  [org.infinispan.remoting.transport.jgroups.JGroupsTransport] (default task-1) ISPN000079: Channel losci_qa local address is losci_qa, physical addresses are [10.10.10.82:60774]

服务器2日志:

2020-09-24 17:17:07,686 INFO  [org.infinispan.factories.GlobalComponentRegistry] (default task-1) ISPN000128: Infinispan version: Infinispan 'Infinity Minus ONE +2' 9.4.11.Final
2020-09-24 17:17:07,936 INFO  [org.infinispan.remoting.transport.jgroups.JGroupsTransport] (default task-1) ISPN000078: Starting JGroups channel losci_qa
2020-09-24 17:17:07,958 INFO  [stdout] (default task-1)
2020-09-24 17:17:07,958 INFO  [stdout] (default task-1) -------------------------------------------------------------------
2020-09-24 17:17:07,958 INFO  [stdout] (default task-1) GMS: address=losci_qa, cluster=losci_qa, physical address=10.100.101.83:39828
2020-09-24 17:17:07,958 INFO  [stdout] (default task-1) -------------------------------------------------------------------
2020-09-24 17:17:09,966 INFO  [org.jgroups.protocols.pbcast.GMS] (default task-1) losci_qa: no members discovered after 2007 ms: creating cluster as first member
2020-09-24 17:17:09,981 INFO  [org.infinispan.CLUSTER] (default task-1) ISPN000094: Received new cluster view for channel losci_qa: [losci_qa|0] (1) [losci_qa]
2020-09-24 17:17:09,989 INFO  [org.infinispan.remoting.transport.jgroups.JGroupsTransport] (default task-1) ISPN000079: Channel losci_qa local address is losci_qa, physical addresses are [10.10.10.83:39828]
通过Infinispan缓存

没有发现成员

网络域相同,群集名称相同。 我在这里做错了什么?如何建立两个节点的集群?我该如何与每个节点通信?

TIA

1 个答案:

答案 0 :(得分:0)

第一个问题可能是防火墙。禁用两个节点上的防火墙并在没有它们的情况下进行测试(您应在修复规则后重新启动它们)。

使用无参数JChannel构造函数,您默认为udp.xmlPING协议默认在228.8.8.8:45588上组播问候消息。检查多播是否在您的计算机上正确路由(例如,使用netcat / nc)。

如果这样做没有帮助,请启用TRACE日志记录以获取更多见解。

相关问题