One: Install download on Apache official website to download Apache version of the latest version of Apache on the line here is the latest apache2.4.18 decompression to any disk after the installation in CMD, such as to D:\apache\Apache24\bin under the command httpd-k Install
After that, the download of JK JK in Tomcat is the application of Tomcat to the HTTP service, which can then be extracted in D:\apache\Apache24\modules
Then you need to install Tomcat to copy N copies (n= how much you need to load) Note that the Tomcat version needs to be consistent don't one is TOMCAT6 one is TOMCAT7
Two: Configuration
1. Configure the Apache configuration file D:\apache\Apache24\conf (this is my path) first httpd.conf
First load the downloaded JK LoadModule jk_module modules/mod_jk.so in the LoadModule loading bottom
After that, LoadModule Rewrite_module modules/mod_rewrite.so Front # is removed.
The next step is to
<ifmodule jk_module>
Jkworkersfile conf/workers.properties
Jkmount/* Controller
Jklogfile Logs/mod_jk.log #这条和下面这条可以取消删掉
Jkloglevel warn
</IfModule>
Add to the bottom of the configuration
2. Create a new workers.properties file in D:\apache\Apache24\conf
Worker.list = Controller
#========tomcat1========
worker.tomcat1.port=8009 #指定tomcat2服务器AJP的端口, default is 8009
worker.tomcat1.host=localhost #指定tomcat2服务器IP或域名
WORKER.TOMCAT1.TYPE=AJP13 #指定tomcat2与apache AJP Communication protocol
Worker.tomcat1.lbfactor=1 #指定负载平衡因数 is only useful if load balancing is enabled.
#========tomcat2========
worker.tomcat2.port=8010
worker.tomcat2.host=172.168.1.31 #也可以用远程
Worker.tomcat2.type=ajp13
Worker.tomcat2.lbfactor=1
#========controller Load Balancing Controller ========
WORKER.CONTROLLER.TYPE=LB #指定controller类型
WORKER.CONTROLLER.BALANCED_WORKERS=TOMCAT1,TOMCAT2 #指定负载平衡的tomcat
Worker.controller.sticky_session=true #指定是否粘性session
Worker.controller.sticky_session_force=false
worker.connection_pool_size=3000
Worker.connection_pool_minsize=50
worker.connection_pool_timeout=50000
# Session Configuration Description:
#当sticky_session, Sticky_session_force are true when the session is not copied,
#sticky_session_force =false refers to a server in a cluster where multiple requests are not responding, then forwarded to other servers for processing,
#sticky_session =false does not use sticky session, while configuring not to copy session, note that the original session may not be found after forwarding the request.
3. Modify the Conf/server.xml of each tomcat
Modify <server port= "10934" shutdown= "shutdown" > Shutdown ports each change to a different one otherwise tomcat cannot be turned on at the same time
After you modify the Tomcat port
<connector port= "8443" protocol= "Org.apache.coyote.http11.Http11Protocol"
Maxthreads= "sslenabled=" true "scheme=" "https" secure= "true"
Clientauth= "false" sslprotocol= "TLS"/>
Make each tomcat port inconsistent and not occupied
<connector port= "10888" protocol= "ajp/1.3" redirectport= "8443"/> After the AJP port is modified to match the port in workers
The next step
<engine name= "Catalina" defaulthost= "localhost" jvmroute= "TOMCAT1" > Comment Open the name of the tomcat1 himself and put the note or delete the one below him.
<engine name= "Catalina" defaulthost= "localhost" >
and the following <cluster classname= "Org.apache.catalina.ha.tcp.SimpleTcpCluster"/> Annotation Open is to open a simple TCP cluster;
4. modify the Web. xml file in the Web-inf directory, add tags
<distributable/>
Just add it to </web-app> before you can, because this is assignable.
Then you're done.
This article from "Faint blog" blog, reproduced please contact the author!
Apache Load Balancer APACHE2.4.18+TOMCAT7 (Windows edition)