Apache Load Balancer Configuration Detailed

Source: Internet
Author: User

Prepare things

Tomcat

Apache Server

Mod_jk-1.2.31-httpd-2.2.3.so

Can not go to the Internet to download a lot of this is not to say how to download


Install Apache First

One

Locate the installation directory modules and rename the downloaded mod_jk-1.2.31-httpd-2.2.3.so mod_jk.so

Example: D:\Program files\apache\modules

And put mod_jk.so in the Modules folder.

Two

Locate the Conf folder

Add File: workers.properties If you have one, you don't have to. Create a new

Add a new Mod_jk.log in the Logs folder to log logs


Three

Open httpd.conf at the end Plus


#加载mod_jk Module
LoadModule Jk_module modules/mod_jk.so
#指定workers. Properties File path
Jkworkersfile conf/workers.properties
#Jk日志
Jklogfile Logs/mod_jk.log
#日志记录级别
Jkloglevel Info
#指定那些请求交给tomcat处理, "LoadBalancer" is the load-distribution controller specified in the Workers.propertise
Jkmount/* LoadBalancer


Write load configuration in workers.properties

Worker.list = LoadBalancer #注意这里要和 jkmount Correspondence
#========tomcat1========
Worker.tomcat1.type=ajp13
#tomcat的主机地址, if not for this machine, please fill in the IP address
worker.tomcat1.host=127.0.0.1
#ajp13端口号, under Tomcat server.xml configuration, default 8009
worker.tomcat1.port=8010
Worker.tomcat1.lbfactor=1
#负载平衡的权重比, if this weight ratio is greater, the more requests are allocated to this node, such as two nodes with a weight ratio of 1:1, then the average allocation


#========tomcat2========
Worker.tomcat2.type=ajp13
#tomcat的主机地址, if not for this machine, please fill in the IP address
worker.tomcat2.host=127.0.0.1
#ajp13端口号, under Tomcat server.xml configuration, default 8009
worker.tomcat2.port=8011
Worker.tomcat2.lbfactor=1
#负载平衡的权重比, if this weight ratio is greater, the more requests are allocated to this node, such as two nodes with a weight ratio of 1:1, then the average allocation


#========tomcat3========
Worker.tomcat3.type=ajp13
#tomcat的主机地址, if not for this machine, please fill in the IP address
worker.tomcat3.host=127.0.0.1
#ajp13端口号, under Tomcat server.xml configuration, default 8009
worker.tomcat3.port=8012
Worker.tomcat3.lbfactor=1
#负载平衡的权重比, if this weight ratio is greater, the more requests are allocated to this node, such as two nodes with a weight ratio of 1:1, then the average allocation


#========loadbalancer, Load Balancer controller ========
Worker.loadbalancer.type=lb
#请求失败以后重试次数
Worker.loadbalancer.retries=3
#controller控制的tomcat的名称, TOMCAT1 and TOMCAT2 respectively, set by Server.xml in Tomcat
Worker.loadbalancer.balance_workers=tomcat1,tomcat2,tomcat3
#回话是否有粘性, false means no stickiness, and the same reply request will be processed in different tomcat
Worker.loadbalancer.sticky_session=false
#当一个节点蹦了, if the value is set to True, then the server returns a 500 error to the client and, if set to false, forwards to the other tomcat, but loses the reply message
Worker.loadbalancer.sticky_session_force=false

When using multiple Tomcat to modify the port can not conflict, after the best start a few try to start normally and access it is no problem





Apache Load Balancer Configuration Detailed

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.