• Like
Apache lb
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

Published

Apache + mod_jk + load balancing

Apache + mod_jk + load balancing

Published in Self Improvement , Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
192
On SlideShare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
4
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Apache Load Balancing :Basic SW Requirements : 1. java 2. Tomcat 3. Apache web server 4. mod_jkPre-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 apps 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,statusworker.tomcat1.port=8009worker.tomcat1.host=localhostworker.tomcat1.type=ajp13worker.tomcat1.lbfactor=1worker.tomcat1.redirect=tomcat2worker.tomcat2.port=8079worker.tomcat2.host=localhostworker.tomcat2.type=ajp13worker.tomcat2.lbfactor=1worker.tomcat2.redirect=tomcat1worker.lb.type=lbworker.lb.balance_workers=tomcat1,tomcat2worker.lb.sticky_session=Trueworker.lb.sticky_session_force=Trueworker.status.type=statusworker.localhost.host=localhostNote : 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.shmNote : 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 =statusNote : 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 statusTomcat 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