我正在尝试在JBoss EAP 6.4上使用HA Singleton。我有两个主机:app-05
,app-06
和两个组:ADM
,DEV
。两个服务器组都使用基于标准HA配置文件的自己的配置文件,并且都使用ha-socket套接字绑定。
+-----------------------------------+
|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单例的集群?
我希望会有两个独立的集群,每个集群都有自己的HA单例实例。
答案 0 :(得分:0)
您是否为组使用不同的JGroups多播地址?两个不同的服务器组对应于两个不同的集群。为了使JBoss群集能够与同一网络中的其他群集正常工作,您需要将其隔离,以免干扰其他群集。这是通过在套接字绑定组中为jgroups-udp
和messaging-group
设置不同的值来完成的 - 例如,通过设置系统属性jboss.default.multicast.address
和jboss.messaging.group.address
。多播地址应在224.0.0.0到239.255.255.255范围内。