我正在尝试使用 Httpd、mod_cluster 和 Tomcat 设置负载平衡器。我的 Httpd 和 Tomcat 运行在同一台服务器上,IP 为 192.168.9.73。这是我的 Httpd 配置-
Listen *:9999
<VirtualHost *:9999>
ManagerBalancerName cluster
<Directory />
Order deny,allow
Deny from none
Allow from all
</Directory>
ProxyPass / balancer://cluster/ stickysession=JSESSIONID|jsessionid nofailover=On
ProxyPassReverse / balancer://cluster/
KeepAliveTimeout 300
MaxKeepAliveRequests 0
ServerAdvertise On
AdvertiseGroup 224.0.1.105:23364
AdvertiseFrequency 5
<Location /mod_cluster_paas>
SetHandler mod_cluster-manager
Order deny,allow
Deny from none
Allow from all
</Location>
</VirtualHost>
和 Tomcat server.xml-
<Engine name="jboss.web" defaultHost="localhost" jvmRoute="node1">
<Listener className="org.jboss.modcluster.container.catalina.standalone.ModClusterListener" advertise="true" proxyList="192.168.9.73:9999"/>
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster" channelSendOptions="6">
<Manager className="org.apache.catalina.ha.session.BackupManager" expireSessionsOnShutdown="false" notifyListenersOnReplication="true" mapSendOptions="6"/>
<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="5000" selectorTimeout="100" maxThreads="6"/>
<Sender className="org.apache.catalina.tribes.transport.ReplicationTransmitter">
<Transport className="org.apache.catalina.tribes.transport.nio.PooledParallelSender"/>
</Sender>
<Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector"/>
<Interceptor className="org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor"/>
<Interceptor className="org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor"/>
</Channel>
<ClusterListener className="org.apache.catalina.ha.session.ClusterSessionListener"/>
</Cluster>
</Engine>
我按照本教程设置了负载平衡器,但它不起作用。在 httpd 错误日志中启动 httpd 和 tomcat 后,我收到此错误消息-
[Wed Mar 13 18:23:51 2013] [error] proxy: CLUSTER: (balancer://cluster). All workers are in error state
每当我尝试打开 192.168.9.73:9999
答案1
我的配置有误。按照 mod_cluster 页面上的教程并添加了 EnableMCPMReceive 属性。
mod_cluster参考链接。