JBoss 两个服务器组上的 EAP HA 单例部署

JBoss EAP HA singleton deployment on two server groups

我正在尝试在 JBoss EAP 6.4 上使用 HA Singleton。我有两个主机:app-05app-06 和两个组:ADMDEV。两个服务器组都使用自己的基于标准 HA 配置文件的配置文件,并且都使用 ha-sockets 套接字绑定。

+-----------------------------------+
|Group v / Host > | app-05 | app-06 |
|-----------------+--------+--------|
|             ADM | ADM_01 | ADM_02 |
|-----------------+--------+--------|
|             DEV | DEV_01 | DEV_02 |
+-----------------------------------+

当我将包含 HA 单例的应用程序分配给其中一个组时,结果如我所料。 app-05 服务器启动:

INFO  [stdout] -------------------------------------------------------------------
INFO  [stdout] GMS: address=app-05:DEV_01/singleton, cluster=singleton, physical address=10.7.0.131:55400
INFO  [stdout] -------------------------------------------------------------------
INFO  [o.i.r.t.j.JGroupsTransport] ISPN000094: Received new cluster view: [app-05:DEV_01/singleton|0] [app-05:DEV_01/singleton]
INFO  [o.i.r.t.j.JGroupsTransport] ISPN000079: Cache local address is app-05:DEV_01/singleton, physical addresses are [10.7.0.131:55400]
INFO  [o.j.a.clustering] JBAS010238: Number of cluster members: 1

并被选为 HA 单例提供者:

INFO  [o.j.a.c.infinispan] JBAS010281: Started default cache from singleton container
INFO  [o.j.a.c.singleton] JBAS010342: app-05:DEV_01/singleton elected as the singleton provider of the jboss.test.ha.singleton service
INFO  [o.j.a.c.singleton] JBAS010340: This node will now operate as the singleton provider of the jboss.test.ha.singleton service

然后app-06服务器启动并形成集群:

INFO  [stdout] -------------------------------------------------------------------
INFO  [stdout] GMS: address=app-06:DEV_02/singleton, cluster=singleton, physical address=10.7.0.132:55400
INFO  [stdout] -------------------------------------------------------------------
INFO  [o.i.r.t.j.JGroupsTransport] ISPN000094: Received new cluster view: [app-05:DEV_01/singleton|1] [app-05:DEV_01/singleton, app-06:DEV_02/singleton]
INFO  [o.i.r.t.j.JGroupsTransport] ISPN000079: Cache local address is app-06:DEV_02/singleton, physical addresses are [10.7.0.132:55400]
INFO  [o.j.a.clustering] JBAS010238: Number of cluster members: 2

,终产第二app-06被选为:

INFO  [o.j.a.c.infinispan] JBAS010281: Started default cache from singleton container
INFO  [o.j.a.c.singleton] JBAS010342: app-06:DEV_02/singleton elected as the singleton provider of the jboss.test.ha.singleton service
INFO  [o.j.a.c.singleton] JBAS010340: This node will now operate as the singleton provider of the jboss.test.ha.singleton service

但是当我将同一个应用程序分配给第二组服务器时,奇怪的事情发生了。所有四台服务器组成一个集群:

INFO  [o.i.r.t.j.JGroupsTransport] ISPN000094: Received new cluster view: [app-05:DEV_01/singleton|2] [app-05:DEV_01/singleton, app-06:DEV_02/singleton, app-06:ADM_02/singleton, app-05:ADM_01/singleton]
INFO  [o.j.a.c.singleton] JBAS010342: app-05:DEV_01/singleton elected as the singleton provider of the jboss.test.ha.singleton service
INFO  [o.j.a.c.singleton] JBAS010340: This node will now operate as the singleton provider of the jboss.test.ha.singleton service

为什么来自不同组并使用不同配置文件的服务器会相互看到?并且都只和一个HA单例成一个cluster?

我希望会有两个独立的集群,每个集群都有自己的 HA 单例实例。

您是否为您的组使用不同的 JGroups 多播地址?两个不同的服务器组对应两个不同的集群。为了 JBoss 集群与同一网络中的其他集群正常工作,您需要将其隔离,使其不干扰其他集群。这是通过在套接字绑定组中为 jgroups-udpmessaging-group 设置不同的值来完成的——例如通过设置系统属性 jboss.default.multicast.addressjboss.messaging.group.address。多播地址应在 224.0.0.0 到 239.255.255.255 范围内。