Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.