LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-02-2017, 07:35 AM   #1
dushyantg
Member
 
Registered: Jun 2016
Posts: 46

Rep: Reputation: Disabled
Apache Tomcat Load Balancing Cluster


Hi,

I am having 3 servers installed with Ubuntu and I want to configure Tomcat Load Balancing.
Server A = 10.0.0.1
Server B = 10.0.0.2
Server C = 10.0.0.3

I have pointed Domain to Server A which is having Apache and Mod_JK installed. while Server B and C is having Apache Tomcat 8.

below is the Details of my workers.properties file

Quote:
workers.apache_log=/var/log/apache2
worker.list=tomcatlb,status
worker.stat1.type=status

worker.tomcat1.type=ajp13
worker.tomcat1.host=10.0.0.2 #put your app host here
worker.tomcat1.port=8009

worker.tomcat2.type=ajp13
worker.tomcat2.host=10.0.0.3
worker.tomcat2.port=8009

worker.tomcat1.lbfactor=1
worker.tomcat2.lbfactor=1

worker.tomcatlb.type=lb
worker.tomcatlb.balance_workers=tomcat1,tomcat2

worker.list=jkstatus
worker.jkstatus.type=status
I have also used jvmRounte name as tomcat1 and tomcat2 in server.xml of both the Apache Tomcat.

i have also added below lines in server.xml

Quote:
<Engine name="Catalina" defaultHost="localhost" jvmRoute="tomcat2">

<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster" channelSendOptions="6">

<Channel className="org.apache.catalina.tribes.group.GroupChannel">
<Membership className="org.apache.catalina.tribes.membership.McastService"
address="228.0.0.4"
port="45564" frequency="500"
dropTime="3000"/>

<Sender className="org.apache.catalina.tribes.transport.ReplicationTransmitter">
<Transport className="org.apache.catalina.tribes.transport.nio.PooledParallelSender"/>
</Sender>

<Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver"
address="auto" port="4001" autoBind="100"
selectorTimeout="5000" maxThreads="6"/>

<Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector"/>
<Interceptor className="org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor"/>
<Interceptor className="org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor"/>

</Channel>
context.xml is like below

Quote:
<?xml version='1.0' encoding='utf-8'?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- The contents of this file will be loaded for each web application -->
<Context>

<!-- Default set of monitored resources. If one of these changes, the -->
<!-- web application will be reloaded. -->
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<WatchedResource>${catalina.base}/conf/web.xml</WatchedResource>

<!-- Uncomment this to disable session persistence across Tomcat restarts -->
<!--
<Manager pathname="" />
-->

<!-- Uncomment this to enable Comet connection tacking (provides events
on session expiration as well as webapp lifecycle) -->
<!--
<Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
-->

<Manager className="org.apache.catalina.ha.session.DeltaManager"
expireSessionsOnShutdown="false"
notifyListenersOnReplication="true"/>
<Manager className="org.apache.catalina.ha.session.BackupManager" />

</Context>
apache configuration is having below lines

Quote:
RewriteEngine on
RewriteRule ^/$ /test [PT,L]
JkMount /* tomcatlb
apache is redirecting the request to Tomcat via mod_jk and its working fine but when one tomcat goes down it should redirect the request to the other tomcat instead of that I have to do relogin as its not replicating the session.

logs are having such error

Quote:
Caused by: javax.servlet.ServletException: javax.servlet.jsp.JspTagException: No message found under code 'error.message.login.LoginError' for locale 'en_US'.
at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:909)
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:838)
at org.apache.jsp.WEB_002dINF.views.login_jsp._jspService(login_jsp.java:188)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:438)
Thanks.

Last edited by dushyantg; 02-02-2017 at 07:38 AM.
 
Old 02-09-2017, 10:20 AM   #2
kentyler
Member
 
Registered: Dec 2008
Location: Newark Ohio
Distribution: Fedora Core
Posts: 270

Rep: Reputation: 37
The configs you have posted don't include sticky sessions so you may want to check into adding that.


Here's a link that may help out:

http://tomcat.apache.org/tomcat-6.0-...ter-howto.html
 
Old 02-13-2017, 08:25 AM   #3
dushyantg
Member
 
Registered: Jun 2016
Posts: 46

Original Poster
Rep: Reputation: Disabled
When I have done Vertical Clustering without adding line of sticky session it's working. I have tried both the ways in this also like with adding line of sticky session = true and without that but no any change.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Load Balancing Configuration error in tomcat sanjay87 Linux - Server 1 03-28-2012 10:50 AM
[SOLVED] I'm looking for a load-balancing cluster? Advice Pro Linux - Newbie 1 03-09-2009 10:52 PM
1 tier cluster with HA and load balancing red_coder Linux - Server 3 04-10-2008 02:29 AM
Load Balancing Cluster kesari Red Hat 3 11-09-2004 02:02 PM
Load Balancing and cluster ? johnyy Linux - Software 1 09-16-2003 09:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration