日期:2014-05-16 浏览次数:20809 次
1、修改apache http server配置文件http.conf,首先load三个model,代码如下:
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
ProxyPass / balancer://tomcatcluster/ ProxyPassReverse / balancer://tomcatcluster/ <Proxy balancer://tomcatcluster> BalancerMember ajp://localhost:8509 route=a BalancerMember ajp://10.1.32.234:8510 route=b BalancerMember ajp://localhost:8510 route=c </Proxy> # 警告:以下这段配置仅用于调试(监控),绝不要添加到生产环境中!!! 此处是监控代理负载的Tomcat群状态 <Location /balancer-manager> SetHandler balancer-manager order Deny,Allow Allow from all Allow from localhost </Location>
<!--Define an AJP 1.3 Connector on port 8009 --> <Connectorport="8009" enableLookups="false" redirectPort="8443" protocol="AJP/1.3" URIEncoding="UTF-8" />
还要配置其route, jvmRoute也须同前面的设置一样。。。代码如下:
<!--Define the top level container in our container hierarchy--> <Enginename="Catalina"defaultHost="localhost"jvmRoute="a">
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster" channelSendOptions="6"> <Manager className="org.apache.catalina.ha.session.BackupManager" expireSessionsOnShutdown="false" notifyListenersOnReplication="true" mapSendOptions="6"/> <!-- <Manager className="org.apache.catalina.ha.session.DeltaManager" expireSessionsOnShutdown="false" notifyListenersOnReplication="true"/> --> <Channel className="org.apache.catalina.tribes.group.GroupChannel"> <Membership className="org.apache.catalina.tribes.membership.McastService" address="228.0.0.4" port="45564" frequency="500" dropTime="3000"/> <Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver" address="auto" port="4001" selectorTimeout="100" maxThreads="6"/> <Sender className="org.apache.catalina.tribes.transport.ReplicationTransmitter"> <Transport classNa