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