Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Apache lb


Published on

Apache + mod_jk + load balancing

Published in: Self Improvement, Technology
  • Be the first to comment

  • Be the first to like this

Apache lb

  1. 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. 3. mod_jk.conf file format :worker.list=lb,, : 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. 2. mod_jk.conf configuration: LoadModule jk_module modules/ JkWorkersFile conf.d/ JkMountFile conf.d/ 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 with httpd 2. JkWorkersFile Including the 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 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. 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