Solved

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

Posted on 2014-01-29
2
451 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 82

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

Myth Busting: MongoDB Scalability (it scales!)

I was talking with one of my colleagues from our Technical Account Manager team about MongoDB’s scalability. He mentioned to me that several customers have been telling him that “MongoDB doesn’t scale!” MongoDB’s scalability was in question?

My response was, “Is that a joke?"

Question has a verified solution.

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

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

631 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