Jboss EAP-6.1.0.Alpha - Clustering - Apache mod_jk - load balancing - 302 redirect issue.
prahari Nov 27, 2013 2:10 PMHi all,
I am trying to create a clustered jboss environment with apache fronting for load balancing.
The versions i am using are: Jboss: EAP-6.1.0.Alpha, Apache httd: 2.2.25, mod_jk: tomcat-connectors-1.2.37.
For clustering jboss, I have started with two VM virtual boxes, installed jboss on both and have configured one as domain-controller and the other as slave.
For the domain controller, in domain.xml, i have defined a server group with ha profile and ha-sockets.
<server-groups>
<server-group name="cluster-ha" profile="ha">
<jvm name="default"/>
<socket-binding-group ref="ha-sockets"/>
</server-group>
</server-groups>
In host.xml, i have added one server:
<servers>
<server name="node-one" group="cluster-ha" auto-start="true">
</server>
</servers>
The domain controller is stated using: domain.sh -Djboss.bind.address=192.168.1.100 -Djboss.bind.address.management=192.168.1.100
For the slave, in host-slave.xml, i have added the secret from the user created on domain-controller and created one server:
<servers>
<server name="node-two" group="cluster-ha" auto-start="true">
</server>
</servers
The slave is stated using: domain.sh --host-config=host-slave.xml -Djboss.domain.master.address=192.168.1.100 -Djboss.bind.address=192.168.1.200 -Djboss.bind.address.management=192.168.1.200
I am able to successfully start both the servers and in the logs i am able to see that the servers are clustered. I am able to deploy applications to the server group and am able to access application on each server individually.
Now to achieve load balancing, on a new server, i have installed Apache 2.2.25, mod_jk (tomcat-connectors-1.2.37).
In httpd.conf, i have enabled ssl_module, and added 1) Include conf/extra/httpd-ssl.conf for SSL conf, 2) Include conf/mod-jk.conf
In mod-jk.cof, have done JkWorkersFile conf/workers.properties to indicate the workers.
The workers.properties is defined as:
###############
# for mapping requests
worker.list=node1,node2,loadbalancer1,status
# Set properties for Node1 (ajp13)
# modify the host as your host IP or DNS name.
worker.node1.host=192.168.1.100
worker.node1.port=8009
worker.node1.type=ajp13
worker.node1.lbfactor=1
worker.node1.connect_timeout=10000
worker.node1.prepost_timeout=10000
worker.node1.socket_keepalive=True
# Set properties for Node2 (ajp13)
# modify the host as your host IP or DNS name.
worker.node2.host=192.168.1.200
worker.node2.port=8009
worker.node2.type=ajp13
worker.node2.lbfactor=1
worker.node2.connect_timeout=10000
worker.node2.prepost_timeout=10000
worker.node2.socket_keepalive=True
# Load-balancing behaviour
worker.loadbalancer1.type=lb
worker.loadbalancer1.balance_workers=node1,node2
worker.loadbalancer1.sticky_session=1
# Add the status worker to the worker list
worker.list=jkstatus
# Define a 'jkstatus' worker using status
worker.jkstatus.type=status
#####################
In httpd-ssl.conf, i have added
JkMount /myapp/* loadbalancer1
JkMount /myapp loadbalancer1
Now when i access the application, the login page is presented and when i submit information, i am redirected back to login page. When i inspect the browser traffic, i see https://webserver1/myapp/login/submit redirect 302 temporarily moved. When i check apache ssl_request logs i see:
192.168.1.11 TLSv1 DHE-RSA-AES256-SHA "POST /myapp/login/submit HTTP/1.1" -
In the access.log i see:
"POST /myapp/login/submit HTTP/1.1" 302 -
When i remove the balancing by removing either node1 or node2 from worker.loadbalancer1.balance_workers=node1,node2, the application run normally.
Please provide any pointers to help me understand where my configuration is wrong.
Thank you in advance and sorry for the really long post.