6 Replies Latest reply on Dec 7, 2010 4:10 AM by jfclere

    Apache load balancing with redirect

    dsehmby

      Hi,



      I  am working on implementing a load balancing/failover solution for our  applications using Apache httpd (v 2.2.16) and Jboss 4.2.1. I have  configured apache and jboss as described in the following link: [community.jboss.org...] 



      However,  I can see that the application is not load balancing across 2 nodes.  Please find httpd.conf cluster config is as follows:



      ...



      Include conf/extra/httpd-ssl.conf

      #

      # Note: The following must must be present to support

      #    starting without SSL on platforms with no /dev/random equivalent

      #    but a statically compiled-in mod_ssl.

      #

      #<IfModule ssl_module>



      SSLProxyEngine on



      SetEnv force-proxy-request-1.0 1

      SetEnv proxy-nokeepalive 1



      ProxyRequests Off

      <Proxy *>

      Order deny,allow

      Allow from all

      </Proxy>



      <Proxy balancer://my_cluster>

      BalancerMember https://myurl/JPBC route=node1

      BalancerMember https://myurl/JPBC route=node2

      </Proxy>



      ProxyPass /JPBC/ balancer://my_cluster/ stickysession=JSESSIONID|jsessionid nofailover=Off

      ProxyPassReverse /JPBC/ balancer://my_cluster/



      ...



      The  reason I am using the same url in the proxy balancer is that it is  being used as a redirect url which is sent back to the clients browser  so the client can punchout with the correct url. If I use an ip:port  then the client wont be able to access our punchout site.



      I  have modified the server.xml on both Jboss nodes to include <Engine  name="jboss.web" defaultHost="localhost" jvmRoute="node1"> for node 1  and <Engine name="jboss.web" defaultHost="localhost"  jvmRoute="node2"> for node 2.

      I have also modified jboss-service.xml to include <attribute name="UseJK">true</attribute>



      The  host file has the url mapped to both ip address on both nodes, node 1  is the first mapping so all requests go to node 1 hence why I dont see  any load balancing.



      If I change node 2 hosts file so  node 2 is the first mapping then requests do get redirected to node 2  but the application shows timeout errors and other problems occur due to  the session not sticking to node 2. I can see that the JSESSIONID  content value is changing from #*$!.node1 to #*$!.node2 and vice versa.



      I  am not sure why sessions are not sticking using the jvmroute  configuration. I would be grateful for any help in solving this problem. 



      Thanks.