0 Replies Latest reply on Apr 22, 2011 3:20 AM by willemnoorduin

    JBoss clustering, mod_ajp and sticky sessions

    willemnoorduin

      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:

       

      root@192.168.0.1 # lynx jboss1:8080/app
      root@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 aap@noot.mies
          DocumentRoot /apps/www.application.nl/data
          ServerName 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 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 ?