Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2014-01-29
2
Medium Priority
?
467 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 83

Accepted Solution

by:
David Johnson, CD, MVP earned 2000 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

Plesk WordPress Toolkit

Plesk's WordPress Toolkit allows server administrators, resellers and customers to manage their WordPress instances, enabling a variety of development workflows for WordPress admins of all skill levels, from beginners to pros.

See why 2/3 of Plesk servers use it.

Question has a verified solution.

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

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

721 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