1

I've tried to implement a high availability service with JBoss and Apache.

The architecture is:

  Apache
|         |
|         |
JBoss1 JBoss2 

There is a balancer implemented from Apache to the JBoss'es, and it's working fine. Sometimes the request is taken by JBoss1, and sometimes by JBoss2, however if some Jboss goes down, the balancer still sends requests to it, so the application sometimes works and sometimes doesn't.

How can I implement a service which detects that if some JBoss is down, it automatically redirects the traffic to the other node?

I tried with hearbeat, but I can't solve it.

Ladadadada
  • 26,337
  • 7
  • 59
  • 90
Andres
  • 111
  • 4

1 Answers1

1

It is a built-in feature of mod_proxy+mod_proxy_balancer or mod_jk.

They rely on AJP protocol : https://community.jboss.org/wiki/UsingModproxyWithJBoss

Just follow this tutorial.

Here an example of Apache HTTP configuration :

<VirtualHost *:80>

    ServerName web-gui-acceptance.myorg.com
    ServerAlias web-gui-acceptance


    ProxyRequests Off
    ProxyPass /web-gui balancer://jbosscluster/web-gui stickysession=JSESSIONID nofailover=On
    ProxyPassReverse /web-gui http://srvlnx01.myorg.com:8080/web-gui
    ProxyPassReverse /web-gui http://srvlnx02.myorg.com:8080/web-gui

    <Proxy *>
      AuthType Kerberos
      [...]
    </Proxy>

    <Proxy balancer://jbosscluster>
        BalancerMember ajp://srvlnx01.myorg.com:8009 route=SRVLNX01_node1
        BalancerMember ajp://srvlnx01.myorg.com:8009 route=SRVLNX02_node1
        ProxySet lbmethod=byrequests
    </Proxy>

</VirtualHost>

And for each JBoss instances :

vi $JBOSS_HOME/server/default/deploy/jbossweb.sar/server.xml

<Engine name="jboss.web" defaultHost="localhost" jvmRoute="SRVLNX01_node1">
    [...]
</Engine>

You can also take a look to HA Proxy

Jean-Rémy Revy
  • 159
  • 2
  • 14