我们终于找到了问题和解决方案。Wildfly 9在同一通信信道内为集群节点和HornetQ发送消息,这似乎会产生冲突。我们通过创建第二个堆栈并在它们之间划分流量来解决这个问题。
对于TCP,工作配置如下:
<stacks default="tcp">
<stack name="tcp">
<transport type="TCP" socket-binding="jgroups-tcp"/>
<protocol type="TCPPING">
<property name="initial_hosts">
node1[7600],node1[7750],node2[7600],node2[7750]
</property>
<property name="port_range">
0
</property>
</protocol>
<protocol type="MERGE2"/>
<protocol type="FD_SOCK" socket-binding="jgroups-tcp-fd"/>
<protocol type="FD"/>
<protocol type="VERIFY_SUSPECT"/>
<protocol type="pbcast.NAKACK2"/>
<protocol type="UNICAST3"/>
<protocol type="pbcast.STABLE"/>
<protocol type="pbcast.GMS"/>
<protocol type="MFC"/>
<protocol type="FRAG2"/>
<protocol type="RSVP"/>
</stack>
<stack name="tcphq">
<transport type="TCP" socket-binding="jgroups-tcp-hq"/>
<protocol type="TCPPING">
<property name="initial_hosts">
node1[7660],node1[7810],node2[7660],node2[7810]
</property>
<property name="port_range">
0
</property>
</protocol>
<protocol type="MERGE2"/>
<protocol type="FD_SOCK" socket-binding="jgroups-tcp-hq-fd"/>
<protocol type="FD"/>
<protocol type="VERIFY_SUSPECT"/>
<protocol type="pbcast.NAKACK2"/>
<protocol type="UNICAST3"/>
<protocol type="pbcast.STABLE"/>
<protocol type="pbcast.GMS"/>
<protocol type="MFC"/>
<protocol type="FRAG2"/>
<protocol type="RSVP"/>
</stack>
</stacks>
您还需要配置HornetQ(使用适当的jgroups堆栈,
tcphq
在这种情况下):
<broadcast-groups>
<broadcast-group name="bg-group1">
<jgroups-stack>tcphq</jgroups-stack>
<jgroups-channel>hq-cluster</jgroups-channel>
<broadcast-period>5000</broadcast-period>
<connector-ref>
http-connector
</connector-ref>
</broadcast-group>
</broadcast-groups>
<discovery-groups>
<discovery-group name="dg-group1">
<jgroups-stack>tcphq</jgroups-stack>
<jgroups-channel>hq-cluster</jgroups-channel>
<refresh-timeout>10000</refresh-timeout>
</discovery-group>
</discovery-groups>
…当然,您需要添加相关
socket-binding
进入
socket-binding-group
:
<socket-binding name="jgroups-tcp-hq" port="7660"/>
<socket-binding name="jgroups-tcp-hq-fd" port="7670"/>
不幸的是,我没有UDP的经验,但我认为原理是一样的。