Question

I have two JBoss AS 7 servers and I'm doing load balancing using mod_proxy. Almost everything works fine besides sticky sessions. I have session id in a cookie not in the URL as JSESSIONID.

Here is my apache configuration:

NameVirtualHost *:80
<VirtualHost *:80>

   ProxyPass / balancer://mycluster/ stickysession=JSESSIONID|jsessionid nofailover=Off
   ProxyPassReverse / balancer://tutcluster/
   ProxyPassReverse / http://server1:8080/
   ProxyPassReverse / http://server2:8080/
   ProxyPreserveHost On
   ProxyRequests Off

   <Location / >
      Order deny,allow
      Allow from All
   </Location>

   <Proxy balancer://mycluster/>
      BalancerMember http://server1:8080 route=jbossWeb1 retry=60
      BalancerMember http://server2:8080 route=jbossWeb2 retry=60
   </Proxy>
</VirtualHost>
Was it helpful?

Solution

OK, I've found it. There were two problems Firstly I forgot to set jvmRoute property in the JBoss configuration. So I set:

<system-properties>
  <property name="jvmRoute" value="nodeX"/>
</system-properties>

and changed workers configuration to:

BalancerMember http://server1:8080 route=nodeX retry=60

The second problem was nofailover=Off. It probably caused that some parts of the static content was loaded from one server and some parts of it -- from another one.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top