[jboss-user] [Beginner's Corner] - JBoss clustering, mod_ajp and sticky sessions

Willem Noorduin do-not-reply at jboss.com
Fri Apr 22 03:20:28 EDT 2011


Willem Noorduin [http://community.jboss.org/people/willemnoorduin] created the discussion

"JBoss clustering, mod_ajp and sticky sessions"

To view the discussion, visit: http://community.jboss.org/message/601585#601585

--------------------------------------------------------------
We have the following architecture:

JBoss-EWS 1.0.1 on 192.168.0.1
JBoss-AS  5.1.0 on 192.168.0.2 (jboss1) and 192.168.0.3 (jboss2)

On the JBoss-AS's there are instances app_i1 on jboss1, and app_i2 on jboss2, and hose together form a cluster (the instances are based on the all profile, so clustering is on.
We have deployed a application app to these instances, such that we can run the application like:

 mailto:root at 192.168.0.1 root at 192.168.0.1 # lynx jboss1:8080/app
 mailto:root at 192.168.0.1 root at 192.168.0.1 # lynx jboss2:8080/app

To configure the commnication between the JBoss-EWS and our JBoss-AS cluster we have made a 
Virtual host copnfiguration:

<Proxy balancer://cluster/>
        BalancerMember ajp://jboss1:8009/app/ route="node1" loadfactor=1 ping=10 ttl=600
        BalancerMember ajp://jboss2:8009/app/ route="node2" loadfactor=1 ping=10 ttl=600
</Proxy>

<VirtualHost *:80>
    ServerAdmin  http://community.jboss.org/mailto:aap@noot.mies aap at noot.mies
    DocumentRoot /apps/www.application.nl/data
    ServerName  http://www.application.nl www.application.nl
    ErrorLog logs/www.application.nl-error_log
    CustomLog logs/www.application.nl-access_log combined
    LogLevel debug

    ProxyTimeout 40
    ProxyStatus On
    ProxyPass /app balancer://cluster/ stickysession=JSESSIONID|jsessionid timeout=10

    <Location /balancer-manager>
        SetHandler balancer-manager
    </Location>
</VirtualHost>

We started this configuration successfully, but what we see is that everytime apache sends a request to for example jboss1, it gets its response from the other clusternode on jboss2, resulting in a 404 and a failure, The solution for this problem is obviously sticky sessions, but I can not get this working. I have tested the following things:

A. Swiching back to good old mod_jk:

workers.properties:

#
# Connection to nlptc27b16 brpp cluster
#
worker.node1.port=8009
worker.node1.host=node1
worker.node1.type=ajp13
worker.node1.lbfactor=50
#
# Connection to nlptc27b17 brpp cluster
#
worker.node2.port=8009
worker.node2.host=node2
worker.node2.type=ajp13
worker.node2.lbfactor=50
#
# Loadbalancing behaviour
#
worker.loadbalancer_cluster.type=lb
worker.loadbalancer_cluster.balance_workers=node1,node2
worker.loadbalancer_cluster.sticky_session=1

I can get this to work (i.e. with the proper JkMounts I can reach the application via its url  http://www.application.nl/app www.application.nl/app). But when I call some functionality (for example login to the app), the same problem occurs. I can see (for example with http watch that the application sends it request to one server and receives the answer from the other. I think this is typical round robin without sticky session.

B. Isolating one node

When I isolate one node in the mod_jk configuration, it does work allright, but obviously we want a cluster running.
When I isolate one node in the proxy_ajp configuration, it doesn't work, but I think I have some of the settings wrong.

*Question*

Can you help me with the settings of JBoss-EWS / JBoss-AS and maybe the application itself ? I have read many solutions on the JBoss Community, but they are all for a wrong version (for example UseJK, which isn't needed anymore by 5.1.0) or they simply don't apply / work in our situation ?
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/601585#601585]

Start a new discussion in Beginner's Corner at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110422/2173aded/attachment.html 


More information about the jboss-user mailing list