Solved

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

Posted on 2014-01-29
2
431 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
firstswap challenge 20 68
jar file executable 12 43
servlet  URL Rewriting 1 27
PHP_POST() error message 9 44
One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…

895 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

12 Experts available now in Live!

Get 1:1 Help Now