Solved

Web pages did not sync with Mod_jk loadbalancer configured with Apache and Jboss in Linux server

Posted on 2014-01-29
2
429 Views
Last Modified: 2014-02-07
Hi,

I have a website that is configured on Jboss on Two Linux instances. Apache Mod_jk is working as a load balance with jboss.

We have a problem with the login process.
•      I went to Firefox and clicked Sign In Here and log in with my credentials at 7:27:20.
•      35 seconds later (7:27:55), the login process appears to have completed; however, the site still says Sign In Here:
o       
•      So I clicked refresh pages and then Account Administration and the site still said Sign In Here.
•      Thinking that the site did not log me in I tried again (47 seconds).
•      The site next took me to the Account Administration page and now said Welcome test user:
o       
•      I logged out and the site properly said Sign In Here. Then I clicked For refresh page and the site said “Welcome test user” but I logged out so why does this happen?

I tried another browser, Chrome:
•      I signed in and it took 38 seconds. This time it properly says Welcome test user
•      I went to For refresh page and was still logged in so I logged out again and the site properly says Sign In Here.
•      Then I clicked Sign In Here and the login page says Welcome test user and has the blank fields for login. This should be impossible:

•      I tried logging in as another user and the site says incorrectly says Sign In Here. I clicked For refresh pages and it said Welcome [with the user’s name], making it look like I am logged in.
•      Then I clicked Account Administration and I am brought to the Sign In page as if I am not logged in.
•      Now I try logging in repeatedly and it keeps asking me to Sign In.
The login is definitely not working right. It says Welcome [Your Name] when you are logged out and Sign In here when you are logged in.

What i did to verify jboss functionality is:

i stopped jboss service from instance A. it works perfectly.

i started jboss service from instance A and stopped jboss service from instance B. it works perfectly.

So i believe Mod_jk load balancer is misbehaving.

Please suggest.
0
Comment
Question by:aloknet21
2 Comments
 
LVL 78

Accepted Solution

by:
David Johnson, CD, MVP earned 500 total points
ID: 39821781
how have you set the affinity and are you using round robin load balancing.  If you have not set affinity for the client then you have to save the session state to a database that is usable by both servers.. otherwise when it switches from server A to server B, server B will see it as a new connection since the session cookie is unknown.
0
 
LVL 1

Author Comment

by:aloknet21
ID: 39832420
I have implemented loadbalance through Mod_jk

Here is worker.properties configuration.


# Define list of workers that will be used
# for mapping requests
# The configuration directives are valid
# for the mod_jk version 1.2.18 and later
#worker.list=loadbalancer,status
#worker.list=node2
worker.list=loadbalancer,status,node2,node1
######START Current Relaese Nodes##########

# Define Node2 Web Live
worker.node2.port=8010
worker.node2.host=192.168.90.6
worker.node2.type=ajp13
worker.node2.lbfactor=1
#worker.node1.prepost_timeout=10000 #Not required if using ping_mode=A
#worker.node1.connect_timeout=10000 #Not required if using ping_mode=A
#worker.node2.ping_mode=A #As of mod_jk 1.2.27

# Define Node2 Web Live
worker.node1.port=8010
worker.node1.host=192.168.90.7
worker.node1.type=ajp13
worker.node1.lbfactor=1
#worker.node1.prepost_timeout=10000 #Not required if using ping_mode=A
#worker.node1.connect_timeout=10000 #Not required if using ping_mode=A
#worker.node1.ping_mode=A #As of mod_jk 1.2.27

# Load-balancing behaviour
worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=node2,node1
#worker.loadbalancer.sticky_session=1

# Status worker for managing load balancer
worker.status.type=status

Here is the configuration of apache for the website

:

<VirtualHost 192.168.90.6:80>
        ServerName www.testprotocols.com
        ServerAlias testprotocols.com
        CustomLog logs/access_log combined

        JkMount /cdp/view/AbouttestProtocolsMobileWebsite.html node2
        JkMount /* loadbalancer

#ProxyRequests           Off
#   ProxyPreserveHost       On
#RewriteEngine           On

        <IfModule mod_rewrite.c>
        RewriteEngine on
        RewriteCond %{REMOTE_ADDR} (.*)
        RewriteRule .* - [E=R_A:%1]
        RequestHeader add TEST_SRC_ADDR %{R_A}e
RewriteCond %{HTTP_HOST} !^www\.testprotocols\.com [NC]
RewriteRule ^(.*)$ http://www.testprotocols.com$1 [L,R=301]

</IfModule>

Here is Mod-jk Configuration details

:

# Load mod_jk module
# Specify the filename of the mod_jk lib
LoadModule jk_module modules/mod_jk.so

# Where to find workers.properties
JkWorkersFile conf/workers.properties
#JkWorkersFile conf/workers1.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 +ForwardURICompat -ForwardDirectories

# JkRequestLogFormat
JkRequestLogFormat "%w %V %T"

JkShmFile logs/jk.shm
# Add jkstatus for managing runtime data
<Location /jkstatus/>
JkMount status
</Location>

</VirtualHost>

Please suggest, where i am missing the point.

Thanks for your help.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
The viewer will learn how to implement Singleton Design Pattern in Java.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now