1 Reply Latest reply on Jul 30, 2009 9:53 AM by diegom

    Affinity and Failover

      Hello

      I have a problem configuring session affinity and failover in a web application
      I'm using apache httpd 2.2, jboss 4.2.3, and mod_jk.1.2.27

      The affinity works fine, until a node goes down. At this moment, failover happens and the httpd server redirects to other (alive) node, but it doesn't set the affinity (¿JSESSIONID cookie?) to this new node.

      In all the JBoss nodes I set :

      In jboss-web.deployer/META-INF/jboss-service.xml

      <attribute name="UseJK" replace="true" trim="true">true</attribute>

      In jboss-web.deployer/server.xml
      <Engine name="jboss.web" defaultHost="localhost" jvmRoute="nodeX">

      with diferent jvmRoute names for each node (in concordance with worker's names)

      The mod-jk.conf file looks similar to this

      # Load mod_jk module
      LoadModule jk_module modules/mod_jk-1.2.27-httpd-2.2.10.so
      
      # Where to find workers.properties
      JkWorkersFile conf/workers.properties
      
      # Where to put jk logs
      JkLogFile logs/mod_jk.log
      
      # Set the jk log level [debug/error/info]
      JkLogLevel info
      
      # Select the log format
      JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
      
      # JkOptions indicates to send SSK KEY SIZE
      JkOptions +ForwardKeySize +ForwardURICompatUnparsed -ForwardDirectories
      
      # JkRequestLogFormat
      JkRequestLogFormat "%w %V %T"
      
      # You can use external file for mount points.
      JkMountFile conf/uriworkermap.properties
      
      # Add shared memory.
      JkShmFile logs/jk.shm
      
      # Add jkstatus for managing runtime data
      <Location /jkstatus >
      JkMount jkstatus
      Order deny,allow
      Deny from all
      Allow from all
      </Location>
      


      And the workers.properties looks like this
      worker.list=loadbalancer,jkstatus
      
      worker.jkstatus.type=status
      
      # Define Node 1
      worker.node1.port=<port>
      worker.node1.host=<ip>
      worker.node1.type=ajp13
      worker.node1.lbfactor=1
      
      # Define Node 2
      worker.node2.port=<port>
      worker.node2.host=<ip>
      worker.node2.type=ajp13
      worker.node2.lbfactor=1
      
      # etc for more nodes...
      
      # Load-balancing behaviour
      worker.loadbalancer.type=lb
      worker.loadbalancer.balance_workers=node1,node2,<etc...>
      worker.loadbalancer.sticky_session=1
      worker.loadbalancer.retries=<number of nodes>
      


      I think the problem is related to the JSESSIONID cookie which doesn't change after failover

      What am I doing wrong?

      Thanks in advance

      PS: excuse my English, but I am a spanish speaker :-)