APACHE2.2+TOMCAT7 Load Balancing Configuration

Source: Internet
Author: User

Ideas and steps: The first step to configure Tomcat, the second step to configure the Apache server, the third step to add the project to Tomcat and test

The first step is to configure Tomcat

1, open the Server.xml under the first tomcat,conf folder, locate the following node and configure:

<ConnectorPort= "10009"Protocol= "ajp/1.3"Redirectport= "8443" />    <Enginename= "Catalina"Defaulthost= "localhost"Jvmroute= "TOMCAT1">    <ClusterClassName= "Org.apache.catalina.ha.tcp.SimpleTcpCluster"/>

2, open the second tomcat,conf folder under Server.xml, locate the following node and configure:

<connector port= "10010" protocol= "ajp/1.3" redirectport= "8443"/>    <engine name= "Catalina" defaultHost= " localhost "jvmroute=" tomcat2 ">    <cluster classname=" Org.apache.catalina.ha.tcp.SimpleTcpCluster "/>

3, if there are more, please make the same configuration, the main difference between Port Jvmroute these places

Second configuration Apache

1. Open the httpd.conf file under the installation directory/conf folder and add the following code to the last line of the file:

Include conf/mod_jk.conf

2, of course, to create mod_jk.conf in the same directory, the file content is as follows:

LoadModule jk_module Modules/mod_jk.sojkworkersfile conf/workers.properties# Specify those requests to Tomcat processing, "controller" Assign the controller name Jkmount/* to the load assigned in workers.propertise

3, download mod_jk.so:http://mirror.bjtu.edu.cn/apache/tomcat/tomcat-connectors/jk/binaries/windows/, note download and Apache The same version of so is placed under the installation directory/modules folder

4, create and configure the Workers.properties file under Conf, with the following content:

Serverworker.list = controller#========tomcat1========worker.tomcat1.port=10009worker.tomcat1.host= Localhostworker.tomcat1.type=ajp13worker.tomcat1.lbfactor = 1#========tomcat2========worker.tomcat2.port= 10010worker.tomcat2.host=localhostworker.tomcat2.type=ajp13worker.tomcat2.lbfactor = 1#========tomcat3======== Worker.tomcat3.port=10011worker.tomcat3.host=localhostworker.tomcat3.type=ajp13worker.tomcat3.lbfactor = 1 #===== ===controller, Load balancer controller ========WORKER.CONTROLLER.TYPE=LBWORKER.CONTROLLER.BALANCE_WORKERS=TOMCAT1,TOMCAT2, Tomcat3worker.controller.sticky_session=falseworker.controller.sticky_session_force=1#worker.controller.sticky _session=1

The third step loads the project and tests

1, you need to load balanced projects, add <distributable/> in the <web-app></web-app> node in Web. XML (Note: This is only one code), copied to other Tomcat

2, test open Browser input: http://localhost/you want to load-balance the project for test access

The article only records the process of solving the problem, may not meet your current configuration and requirements, if not meet your needs, please continue to Baidu

Attach an article about Apache+tomcat multi-project Load Balancing

http://www.iteye.com/problems/72331

APACHE2.2+TOMCAT7 Load Balancing Configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.