Let's talk about the environment:
Apache 2. 2 .*
Tomcat6
Windows XP SP3
Jdk I think everyone should be over 1.6.
I only made two Tomcat clusters here.
Install apahce
Find the httpd. conf file in the installation directory.
Add the following content to others:
Proxypass/balancer: // tomcatcluster/lbmethod = byrequests stickysession = JSESSIONID nofailover = off timeout = 5 maxattempts = 3
Proxypassreverse/balancer: // tomcatcluster/
<Proxy balancer: // tomcatcluster>
Balancermember AJP: // localhost: 8009 route =
Balancermember AJP: // localhost: 9009 route = B
</Proxy>
<Virtualhost *: 80>
Serveradmin fengqingtao@gmail.com
Servername localhost
Proxypass/balancer: // tomcatcluster/
Proxypassreverse/balancer: // tomcatscluster/
Errorlog "log/dummy-host2.localhost-error.log"
Customlog "logs/dummy-host2.localhost-access.log" common
</Virtualhost>
Uncomment the following strings.
#### --------- Cluster ----------------###
Loadmodule proxy_module modules/mod_proxy.so
Loadmodule proxy_ajp_module modules/mod_proxy_ajp.so
Loadmodule proxy_balancer_module modules/mod_proxy_balancer.so
Loadmodule proxy_connect_module modules/mod_proxy_connect.so
Loadmodule proxy_ftp_module modules/mod_proxy_ftp.so
Loadmodule proxy_http_module modules/mod_proxy_http.so
#### --------- Cluster ----------------###
Finally, open CONF/server. XML in Tomcat.
Find this sentence:
<Engine name = "Catalina" defaulthost = "localhost">
Changed to: <engine name = "Catalina" defaulthost = "localhost" jvmroute = "A">
Modify server. xml of another tomcat
<Engine name = "Catalina" defaulthost = "localhost" jvmroute = "B">
Restart Apache and start Tomcat.
of course, if you run Tomcat on the same computer, you must change the port. Check the Tomcat port on the Internet.