日期:2014-05-16 浏览次数:20866 次
我是实现了一个机子上的多个tomcat负载
一.tomcat设置,修改server.xml文件
? 1.tomcat0
?
<Engine name="Catalina" defaultHost="localhost" jvmRoute="Tomcat0">
?
? ? ?三个端口代码片段? ??
<Server port="8005" shutdown="SHUTDOWN">
<Connector port="8080" protocol="HTTP/1.1"?
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />?
??2.tomcat1
?
jvmRoute="Tomcat1" ?
<Server port="8004" shutdown="SHUTDOWN"> <Connector port="8079" protocol="HTTP/1.1" <Connector port="8008" protocol="AJP/1.3" redirectPort="8443" />?
二、apache配置
?
?
?
LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_ajp_module modules/mod_proxy_ajp.so LoadModule proxy_http_module modules/mod_proxy_http.so LoadModule proxy_balancer_module modules/mod_proxy_balancer.so NameVirtualHost *:80 <VirtualHost *:80> ServerName www.XXX.com ProxyIOBufferSize 8192 DocumentRoot C:/ftp/tomcat0/webapps/ROOT DirectoryIndex index.jsp <Directory "C:/ftp/tomcat0/webapps/ROOT"> Options Indexes FollowSymLinks AllowOverride All Order allow,deny Allow from all </Directory> ProxyPass /mpic/ ! ProxyPass /s/ ! ProxyPass /images/ ! ProxyPass /css/ ! ProxyRequests Off ProxyPass / balancer://myCluster/ <Proxy balancer://myCluster/> BalancerMember ajp://localhost:8009 route=Tomcat0 BalancerMember ajp://localhost:8008 route=Tomcat1 </Proxy> </VirtualHost>?
?