On a multi-interface systems, it is necessary to pick the right interface the balancer should send to
and worker should receive from. Merely setting UDP multicast address and port is not enough.
- With Apache HTTP Server, this is achieved by AdvertiseBindAddress directive (though the default is wrong MODCLUSTER-487)
- With Undertow mod_cluster proxy in Wildfly, the interface could be set in socket bindings, e.g.:
- In the case of Tomcat/JBossWeb, historical mod_cluster 1.x documentation suggests that it is done "automatically": interface on which mod_cluster's internal connection was established.
The statement from the historical documentation doesn't make much sense to me – which internal connection?
The actual result is that if you have 2 boxes, 2 interfaces each:
Box 1: enp1s0:10.16.88.186, enp2s0:172.17.71.254, all connectors including advertisement bound to enp2s0:172.17.71.254
Box 2: enp1s0:10.16.88.181, enp2s0:172.17.66.254, HTTP/AJP connectors bound to enp2s0:172.17.66.254
The worker node is unable to receive balancer's advertising. The tomcat actually listens for advertisements on enp1s0:10.16.88.181, because if I rebind the balancer to enp1s0:10.16.88.186, the whole setup suddenly works. I also verified it with the Advertize.java utility.
IMHO, we have to either make it configurable via listener's attribute or fetch the interface from one of the available connectors (sometimes AJP is not configured, sometimes HTTP(S) ain't – but at least one is always present).