1. Required Software
In Apache 2.0
Http://mirror.bjtu.edu.cn/apache//httpd/binaries/win32/httpd-2.2.16-win32-x86-no_ssl.msi
Tomcat 6.0
Http://labs.renren.com/apache-mirror//tomcat/tomcat-6/v6.0.29/bin/apache-tomcat-6.0.29-windows-x86.zip
Mod_jk
Http://mirror.bjtu.edu.cn/apache/tomcat/tomcat-connectors/jk/binaries/win32/jk-1.2.30/mod_jk-1.2.30-httpd-2.2.3.so
2. install Apache and tomcat.
Install Apache to make it accessible.
SetMod_jk-1.2.30-httpd-2.2.3.soModify the file name in mod_jk.so and copy it to the modules directory.
Install three Tomcat servers.
Modify the Tomat configuration file server. xml.
Modify location:
Modify ports separately
Tomcat1:
<Server port = "8005" shutdown = "shutdown">
<Connector Port = "8080" protocol = "HTTP/1.1"
Connectiontimeout = "20000"
Redirectport = "8443" type = "regxph" text = "yourobjectname"/>
<Connector Port = "8009" protocol = "AJP/1.3" redirectport = "8443"/>
<Engine name = "Catalina" defaulthost = "localhost" jvmroute ="S1">
Remove note:
<Cluster classname = "org. Apache. Catalina. Ha. tcp. simpletcpcluster"/>
Tomcat2:
<Server port = "9005" shutdown = "shutdown">
<Connector Port = "9080" protocol = "HTTP/1.1"
Connectiontimeout = "20000"
Redirectport = "8443" type = "regxph" text = "yourobjectname"/>
<Connector Port = "9009" protocol = "AJP/1.3" redirectport = "8443"/>
<Engine name = "Catalina" defaulthost = "localhost" jvmroute ="S2">
Remove note:
<Cluster classname = "org. Apache. Catalina. Ha. tcp. simpletcpcluster"/>
Tomcat3:
<Server port = "7005" shutdown = "shutdown">
<Connector Port = "7080" protocol = "HTTP/1.1"
Connectiontimeout = "20000"
Redirectport = "8443" type = "regxph" text = "yourobjectname"/>
<Connector Port = "7009" protocol = "AJP/1.3" redirectport = "8443"/>
<Engine name = "Catalina" defaulthost = "localhost" jvmroute ="S3">
Remove note:
<Cluster classname = "org. Apache. Catalina. Ha. tcp. simpletcpcluster"/>
Configure Server Load balancer
In the conf directory of Apache.
Add a file jk_mod.conf.
Content:
Loadmodule jk_module modules/mod_jk.so
### Configure mod_jk
# Loading workers in a cluster
Jkworkersfile CONF/workers. Properties
# Files processed by Tomcat
Jkmount/*. jsp loadbalancer
# Loading workers requests to process allocated files
# Jkmountfile CONF/uriworkermap. Properties
# Specify the log output file of JK
Jklogfile logs/mod_jk.log
# Specify the Log Level
Jkloglevel warn
Create the workers. properties file in the apacheconf directory.
# Worker list
Worker. List =S1, S2, S3, loadbalancer
# Configuration of the first server, named S1
# Ajp13 port number, which is configured in server. xml under tomcat. The default value is 8009.
Worker. s1.port = 8009
# Tomcat host address. Fill in the IP address if it is not the local host.
Worker. s1.host = localhost
Worker. s1.type = ajp13
# Server weighted proportion. The higher the value, the more requests are allocated.
Worker. s1.lbfactor = 1
# Configuration of the second server, server name S2
Worker. s2.port = 9009
Worker. s2.host = localhost
Worker. s2.type = ajp13
Worker. s2.lbfactor = 1
# Configuration of the third server, named S3
Worker. s3.port = 7009
Worker. s3.host = localhost
Worker. s3.type = ajp13
Worker. s3.lbfactor = 1
# Server name: controller for Server Load balancer
Worker. loadbalancer. type = LB
Worker. retries = 3 # Number of Retries
# Specify the server list for request sharing, separated by commas
Worker. loadbalancer. balanced_workers =S1, S2, S3
# Set whether the Session of the server used for Server Load balancer can be shared, and set later requests to access the server on the same machine. Sticky_session_force is set to 1,
# When one machine goes down, the session is copied to another server.
Worker. loadbalancer. sticky_session = 1
# Worker. loadbalancer. sticky_session_force = 1
# Worker. Status. type = Status
Modify the HTTP. conf file
Add a row
Include CONF/jk_mod.conf
Configure session replication.
Modify each applicationProgramWeb. xml file.
Add a row to the file.
<Distributable/>
In this way, the session can be copied in different Tomcat servers.