Tomcat

使用 Httpd mod_cluster 和 tomcat 的負載平衡不起作用

  • December 19, 2014

我正在嘗試使用 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

我的配置有錯誤。遵循 mod_cluster 頁面上的教程並添加了 EnableMCPMReceive 屬性。

mod_cluster參考連結

引用自:https://serverfault.com/questions/487297