SlideShare a Scribd company logo
Apache Load Balancing :

Basic SW Requirements :
           1. java
           2. Tomcat
           3. Apache web server
           4. mod_jk

Pre-Check :
              1. Java home/path settings in environment
              2. Test and ensure tomcat instance / httpd [Apache web server] is running .

Basic Configuration:
              1. enable mod_jk in apache configuration file . Ensure in below paths and files :
                  1. /etc/httpd/modules (or) /usr/lib64/httpd/modules/
                  2./usr/libexec/
              2. need to create the following files to integrate tomcat app's with apache httpd
                  server under /etc/httpd/conf.d/.
                  1. worker.properties
                  2.uriworkermap.properties
                  3. mod_jk.conf
 worker.properties file format :

worker.list=lb,status

worker.tomcat1.port=8009
worker.tomcat1.host=localhost
worker.tomcat1.type=ajp13
worker.tomcat1.lbfactor=1
worker.tomcat1.redirect=tomcat2

worker.tomcat2.port=8079
worker.tomcat2.host=localhost
worker.tomcat2.type=ajp13
worker.tomcat2.lbfactor=1
worker.tomcat2.redirect=tomcat1

worker.lb.type=lb
worker.lb.balance_workers=tomcat1,tomcat2
worker.lb.sticky_session=True
worker.lb.sticky_session_force=True

worker.status.type=status
worker.localhost.host=localhost

Note :
   1. while enabling LB we need to declare lb worker in worker.list [It is not workers.list]
   2. Change the native AJP port as per the infrastructure security policy in tomcat server.xml
       files . And ensure the tomcat is running on that port while running .
       [netstat -nap |grep java]
   3. update the details for each instances as per the above format .
   4. Finally declare loadbalancer with the above attributes [balance_workers[it is not
       balance_worker],sticky_session.sticky_session_force ]
   5. declaring the status worker to check the status of Load Balancing
mod_jk.conf configuration:

         LoadModule jk_module modules/mod_jk.so
         JkWorkersFile conf.d/worker.properties
         JkMountFile conf.d/uriworkermap.properties
         JkLogFile /var/log/mod_jk.log
         JkLogLevel info
         JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
         JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
         JkRequestLogFormat "%w %V %T"
         JkShmFile logs/jk.shm

Note :
         1.   1st line including the mod_jk.so with httpd
         2.   JkWorkersFile Including the worker.properties file
         3.   JkMountFile we are declaring the worker and mounting point details .
         4.   4th line saying the log file location
         5.   Other attributes saying the log formates and final line is about memory details .

uriworkermap.properties file :

         #/admin/*=lb
         #/manager/*=lb
         #/jsp-examples/*=lb
         #/servlets-examples/*=lb
         #/examples/*=lb
         #/jk-manager=status
         /* =lb
         /status =status

Note :
         Declaring the mount points with the specific worker details
         We are using with load balancing so we can declare with loadbalancer worker [lb] .
         Loadbalancer worker will take care the distribution of the load and session status

Tomcat configuration[server.xml]:

               1. we need to change the native ports in tomcat server.xml file as per the
                  requirements
                  [We have used here 8009 & 8079]
                  ex :
                  <Connector port="8009" protocol="AJP/1.3" redirectPort="8473" />
 in tomcat1
                  <Connector port="8079" protocol="AJP/1.3" redirectPort="8473" />
 in tomcat2
               2. change the jvmRoute name as per the workers declaration.
                  Ex:
                  in tomcat1
                  <Engine name="Catalina" defaultHost="localhost" jvmRoute="tomcat1">
                  in tomcat1
                  <Engine name="Catalina" defaultHost="localhost" jvmRoute="tomcat2">
Final steps :

           1. Once done all the configuration as per the above details start the tomcat instances
              and apache server . Check the service status and log details for the information .
           2. To verify the session status in load balancing Please create index.jsp with
              identification [page color/ content different ] in $TOMCAT_HOME/webapps/ROOT/
           3. access the server in two different session and confirm the load balance status. It
              need to handle the sessions separately.


K.KarthiKeyan

More Related Content

What's hot

Oracle Flashback Query 3
Oracle Flashback Query 3Oracle Flashback Query 3
Oracle Flashback Query 3
grogers1124
 

What's hot (20)

Pandora FMS: Tomcat Monitoring
Pandora FMS: Tomcat MonitoringPandora FMS: Tomcat Monitoring
Pandora FMS: Tomcat Monitoring
 
Groovy in Mule
Groovy in MuleGroovy in Mule
Groovy in Mule
 
Mule Clustering
Mule Clustering Mule Clustering
Mule Clustering
 
Mapping and listing with mule
Mapping and listing with muleMapping and listing with mule
Mapping and listing with mule
 
R Apache
R ApacheR Apache
R Apache
 
Caching & validating
Caching & validatingCaching & validating
Caching & validating
 
introduction to Tomcat Apache
introduction to Tomcat Apache introduction to Tomcat Apache
introduction to Tomcat Apache
 
Mapping and listing with mule
Mapping and listing with muleMapping and listing with mule
Mapping and listing with mule
 
Mapping and listing in mule
Mapping and listing in muleMapping and listing in mule
Mapping and listing in mule
 
What's New in LuaRocks - Lua Workshop 2014 - Hisham Muhammad
What's New in LuaRocks - Lua Workshop 2014 - Hisham MuhammadWhat's New in LuaRocks - Lua Workshop 2014 - Hisham Muhammad
What's New in LuaRocks - Lua Workshop 2014 - Hisham Muhammad
 
Oracle Flashback Query 3
Oracle Flashback Query 3Oracle Flashback Query 3
Oracle Flashback Query 3
 
Get Going With RVM and Rails 3
Get Going With RVM and Rails 3Get Going With RVM and Rails 3
Get Going With RVM and Rails 3
 
Deployment ibm connections - No Http Server required
Deployment ibm connections - No Http Server requiredDeployment ibm connections - No Http Server required
Deployment ibm connections - No Http Server required
 
MySQL 5.1 Replication
MySQL 5.1 ReplicationMySQL 5.1 Replication
MySQL 5.1 Replication
 
Passing java arrays in oracle stored procedure from mule esb flow
Passing java arrays in oracle stored procedure from mule esb flowPassing java arrays in oracle stored procedure from mule esb flow
Passing java arrays in oracle stored procedure from mule esb flow
 
Simple groovy example in mule
Simple groovy example in muleSimple groovy example in mule
Simple groovy example in mule
 
MySQL 5.5
MySQL 5.5MySQL 5.5
MySQL 5.5
 
Cake php
Cake phpCake php
Cake php
 
Rails3 way
Rails3 wayRails3 way
Rails3 way
 
Pluggable database tutorial 2
Pluggable database tutorial 2Pluggable database tutorial 2
Pluggable database tutorial 2
 

Viewers also liked

Складові комп"ютера та їх призначення
Складові комп"ютера та їх призначенняСкладові комп"ютера та їх призначення
Складові комп"ютера та їх призначення
sveta7940
 
August 1987 1988 The Eighteenth Annual Report Of The Council on Environmental...
August 1987 1988 The Eighteenth Annual Report Of The Council on Environmental...August 1987 1988 The Eighteenth Annual Report Of The Council on Environmental...
August 1987 1988 The Eighteenth Annual Report Of The Council on Environmental...
Obama White House
 
304400_OYDER_MM_2015_Haziran Raporu_v4 0_Basin
304400_OYDER_MM_2015_Haziran Raporu_v4 0_Basin304400_OYDER_MM_2015_Haziran Raporu_v4 0_Basin
304400_OYDER_MM_2015_Haziran Raporu_v4 0_Basin
Ozgur Tezer
 
Q3 2014 Investor Factbook
Q3 2014 Investor FactbookQ3 2014 Investor Factbook
Q3 2014 Investor Factbook
TMUS_IR
 

Viewers also liked (20)

APP Email 7.28.05 (b)
APP Email 7.28.05 (b)APP Email 7.28.05 (b)
APP Email 7.28.05 (b)
 
Escalabilidad
EscalabilidadEscalabilidad
Escalabilidad
 
Kyoto Email 4.10.01
Kyoto Email 4.10.01Kyoto Email 4.10.01
Kyoto Email 4.10.01
 
Складові комп"ютера та їх призначення
Складові комп"ютера та їх призначенняСкладові комп"ютера та їх призначення
Складові комп"ютера та їх призначення
 
presentació blogger
presentació bloggerpresentació blogger
presentació blogger
 
August 1987 1988 The Eighteenth Annual Report Of The Council on Environmental...
August 1987 1988 The Eighteenth Annual Report Of The Council on Environmental...August 1987 1988 The Eighteenth Annual Report Of The Council on Environmental...
August 1987 1988 The Eighteenth Annual Report Of The Council on Environmental...
 
304400_OYDER_MM_2015_Haziran Raporu_v4 0_Basin
304400_OYDER_MM_2015_Haziran Raporu_v4 0_Basin304400_OYDER_MM_2015_Haziran Raporu_v4 0_Basin
304400_OYDER_MM_2015_Haziran Raporu_v4 0_Basin
 
Q3 2014 Investor Factbook
Q3 2014 Investor FactbookQ3 2014 Investor Factbook
Q3 2014 Investor Factbook
 
แบบทดสอบ เรื่อง หน่วยการวัด
แบบทดสอบ เรื่อง หน่วยการวัดแบบทดสอบ เรื่อง หน่วยการวัด
แบบทดสอบ เรื่อง หน่วยการวัด
 
FOTOinformator 1-3-2014
FOTOinformator 1-3-2014FOTOinformator 1-3-2014
FOTOinformator 1-3-2014
 
Presentation 1 (2)
Presentation 1 (2)Presentation 1 (2)
Presentation 1 (2)
 
LibreOfficeの最近の動向とDebianでのLibreOfficeパッケージについて
LibreOfficeの最近の動向とDebianでのLibreOfficeパッケージについてLibreOfficeの最近の動向とDebianでのLibreOfficeパッケージについて
LibreOfficeの最近の動向とDebianでのLibreOfficeパッケージについて
 
Question 2
Question 2Question 2
Question 2
 
APP Email 08.03.05
APP Email 08.03.05APP Email 08.03.05
APP Email 08.03.05
 
OPIC Released Documents 1-10
OPIC Released Documents 1-10OPIC Released Documents 1-10
OPIC Released Documents 1-10
 
LibreOffice No coding extention(ClipArt)
LibreOffice No coding extention(ClipArt)LibreOffice No coding extention(ClipArt)
LibreOffice No coding extention(ClipArt)
 
[학생발표]십자성마을_2020에너지자립비전및계획_2014SEL포럼
[학생발표]십자성마을_2020에너지자립비전및계획_2014SEL포럼[학생발표]십자성마을_2020에너지자립비전및계획_2014SEL포럼
[학생발표]십자성마을_2020에너지자립비전및계획_2014SEL포럼
 
GÊNESIS 14
GÊNESIS 14GÊNESIS 14
GÊNESIS 14
 
Django
DjangoDjango
Django
 
What to do when they've had too much Scratch?
What to do when they've had too much Scratch?What to do when they've had too much Scratch?
What to do when they've had too much Scratch?
 

Similar to Apache lb

Apache Tomcat 8 Application Server
Apache Tomcat 8 Application ServerApache Tomcat 8 Application Server
Apache Tomcat 8 Application Server
mohamedmoharam
 
B2 2006 tomcat_clusters
B2 2006 tomcat_clustersB2 2006 tomcat_clusters
B2 2006 tomcat_clusters
Steve Feldman
 
Integrating tomcat with apache
Integrating tomcat with apacheIntegrating tomcat with apache
Integrating tomcat with apache
govindraj8787
 
解读server.xml文件
解读server.xml文件解读server.xml文件
解读server.xml文件
wensheng wei
 
DataBase Connectivity
DataBase ConnectivityDataBase Connectivity
DataBase Connectivity
Akankshaji
 

Similar to Apache lb (20)

Tomcat Server
Tomcat ServerTomcat Server
Tomcat Server
 
Tomcat Configuration (1)
Tomcat Configuration (1)Tomcat Configuration (1)
Tomcat Configuration (1)
 
Tomcat tutorail
Tomcat tutorailTomcat tutorail
Tomcat tutorail
 
Tomcat 6: Evolving our server
Tomcat 6: Evolving our serverTomcat 6: Evolving our server
Tomcat 6: Evolving our server
 
Apache
ApacheApache
Apache
 
Apache Tomcat 8 Application Server
Apache Tomcat 8 Application ServerApache Tomcat 8 Application Server
Apache Tomcat 8 Application Server
 
Auxiliary : Tomcat
Auxiliary : TomcatAuxiliary : Tomcat
Auxiliary : Tomcat
 
For each In MULE
For each In MULEFor each In MULE
For each In MULE
 
B2 2006 tomcat_clusters
B2 2006 tomcat_clustersB2 2006 tomcat_clusters
B2 2006 tomcat_clusters
 
Integrating tomcat with apache
Integrating tomcat with apacheIntegrating tomcat with apache
Integrating tomcat with apache
 
Information on Tomcat in cPanel & WHM
Information on Tomcat in cPanel & WHMInformation on Tomcat in cPanel & WHM
Information on Tomcat in cPanel & WHM
 
解读server.xml文件
解读server.xml文件解读server.xml文件
解读server.xml文件
 
Web Applications and Deployment
Web Applications and DeploymentWeb Applications and Deployment
Web Applications and Deployment
 
DataBase Connectivity
DataBase ConnectivityDataBase Connectivity
DataBase Connectivity
 
Bt0083 server side programing 2
Bt0083 server side programing  2Bt0083 server side programing  2
Bt0083 server side programing 2
 
Hackingtomcat
HackingtomcatHackingtomcat
Hackingtomcat
 
Hacking Tomcat
Hacking TomcatHacking Tomcat
Hacking Tomcat
 
Lect06 tomcat1
Lect06 tomcat1Lect06 tomcat1
Lect06 tomcat1
 
Tomcat server
 Tomcat server Tomcat server
Tomcat server
 
New Flash Builder 4 WSDL and HTTP Connectors
New Flash Builder 4 WSDL and HTTP ConnectorsNew Flash Builder 4 WSDL and HTTP Connectors
New Flash Builder 4 WSDL and HTTP Connectors
 

Recently uploaded

Recently uploaded (6)

What Is The Psychology Behind Reborn Dolls_.pptx
What Is The Psychology Behind Reborn Dolls_.pptxWhat Is The Psychology Behind Reborn Dolls_.pptx
What Is The Psychology Behind Reborn Dolls_.pptx
 
Welcomer Meeting to achieve the target ..
Welcomer Meeting to achieve the target ..Welcomer Meeting to achieve the target ..
Welcomer Meeting to achieve the target ..
 
BECOMING A VEGETARIAN- Animal Cruelty, Speciesism, Sanatan & Biological Reaso...
BECOMING A VEGETARIAN- Animal Cruelty, Speciesism, Sanatan & Biological Reaso...BECOMING A VEGETARIAN- Animal Cruelty, Speciesism, Sanatan & Biological Reaso...
BECOMING A VEGETARIAN- Animal Cruelty, Speciesism, Sanatan & Biological Reaso...
 
Youth Empowerment - Supporting the Next Generation of Changemakers.pdf
Youth Empowerment - Supporting the Next Generation of Changemakers.pdfYouth Empowerment - Supporting the Next Generation of Changemakers.pdf
Youth Empowerment - Supporting the Next Generation of Changemakers.pdf
 
UNIVERSAL HUMAN VALUES- Harmony in the Nature
UNIVERSAL HUMAN VALUES- Harmony in the NatureUNIVERSAL HUMAN VALUES- Harmony in the Nature
UNIVERSAL HUMAN VALUES- Harmony in the Nature
 
SOCIOLOGY PPT. SOCIAL SECURITY POWER POINT
SOCIOLOGY PPT. SOCIAL SECURITY POWER POINTSOCIOLOGY PPT. SOCIAL SECURITY POWER POINT
SOCIOLOGY PPT. SOCIAL SECURITY POWER POINT
 

Apache lb

  • 1. Apache Load Balancing : Basic SW Requirements : 1. java 2. Tomcat 3. Apache web server 4. mod_jk Pre-Check : 1. Java home/path settings in environment 2. Test and ensure tomcat instance / httpd [Apache web server] is running . Basic Configuration: 1. enable mod_jk in apache configuration file . Ensure in below paths and files : 1. /etc/httpd/modules (or) /usr/lib64/httpd/modules/ 2./usr/libexec/ 2. need to create the following files to integrate tomcat app's with apache httpd server under /etc/httpd/conf.d/. 1. worker.properties 2.uriworkermap.properties 3. mod_jk.conf worker.properties file format : worker.list=lb,status worker.tomcat1.port=8009 worker.tomcat1.host=localhost worker.tomcat1.type=ajp13 worker.tomcat1.lbfactor=1 worker.tomcat1.redirect=tomcat2 worker.tomcat2.port=8079 worker.tomcat2.host=localhost worker.tomcat2.type=ajp13 worker.tomcat2.lbfactor=1 worker.tomcat2.redirect=tomcat1 worker.lb.type=lb worker.lb.balance_workers=tomcat1,tomcat2 worker.lb.sticky_session=True worker.lb.sticky_session_force=True worker.status.type=status worker.localhost.host=localhost Note : 1. while enabling LB we need to declare lb worker in worker.list [It is not workers.list] 2. Change the native AJP port as per the infrastructure security policy in tomcat server.xml files . And ensure the tomcat is running on that port while running . [netstat -nap |grep java] 3. update the details for each instances as per the above format . 4. Finally declare loadbalancer with the above attributes [balance_workers[it is not balance_worker],sticky_session.sticky_session_force ] 5. declaring the status worker to check the status of Load Balancing
  • 2. mod_jk.conf configuration: LoadModule jk_module modules/mod_jk.so JkWorkersFile conf.d/worker.properties JkMountFile conf.d/uriworkermap.properties JkLogFile /var/log/mod_jk.log JkLogLevel info JkLogStampFormat "[%a %b %d %H:%M:%S %Y] " JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories JkRequestLogFormat "%w %V %T" JkShmFile logs/jk.shm Note : 1. 1st line including the mod_jk.so with httpd 2. JkWorkersFile Including the worker.properties file 3. JkMountFile we are declaring the worker and mounting point details . 4. 4th line saying the log file location 5. Other attributes saying the log formates and final line is about memory details . uriworkermap.properties file : #/admin/*=lb #/manager/*=lb #/jsp-examples/*=lb #/servlets-examples/*=lb #/examples/*=lb #/jk-manager=status /* =lb /status =status Note : Declaring the mount points with the specific worker details We are using with load balancing so we can declare with loadbalancer worker [lb] . Loadbalancer worker will take care the distribution of the load and session status Tomcat configuration[server.xml]: 1. we need to change the native ports in tomcat server.xml file as per the requirements [We have used here 8009 & 8079] ex : <Connector port="8009" protocol="AJP/1.3" redirectPort="8473" /> in tomcat1 <Connector port="8079" protocol="AJP/1.3" redirectPort="8473" /> in tomcat2 2. change the jvmRoute name as per the workers declaration. Ex: in tomcat1 <Engine name="Catalina" defaultHost="localhost" jvmRoute="tomcat1"> in tomcat1 <Engine name="Catalina" defaultHost="localhost" jvmRoute="tomcat2">
  • 3. Final steps : 1. Once done all the configuration as per the above details start the tomcat instances and apache server . Check the service status and log details for the information . 2. To verify the session status in load balancing Please create index.jsp with identification [page color/ content different ] in $TOMCAT_HOME/webapps/ROOT/ 3. access the server in two different session and confirm the load balance status. It need to handle the sessions separately. K.KarthiKeyan