簡體   English   中英

沒有負載平衡器的Tomcat集群

[英]Tomcat clustering without load balancer

我已經嘗試過設置Tomcat集群,並且想知道是否有必要使用負載平衡器。 他們在文檔中告訴您,您只需添加

<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>

到配置文件以使群集工作。 我已將以下默認配置添加到我的實例(全部位於不同的機器,相同的網絡上):

<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"
             channelSendOptions="8">

      <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="4000"
                  autoBind="100"
                  selectorTimeout="5000"
                  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.MessageDispatchInterceptor"/>
      </Channel>

      <Valve className="org.apache.catalina.ha.tcp.ReplicationValve"
             filter=""/>
      <Valve className="org.apache.catalina.ha.session.JvmRouteBinderValve"/>

      <Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer"
                tempDir="/tmp/war-temp/"
                deployDir="/tmp/war-deploy/"
                watchDir="/tmp/war-listen/"
                watchEnabled="false"/>

      <ClusterListener className="org.apache.catalina.ha.session.ClusterSessionListener"/>
    </Cluster>

經過一些測試后,我得到了集群無法正常工作的印象,但是在尋找確切的問題之前,我想知道是否需要負載均衡器才能使集群正常工作。 如果沒有,我想知道擁有一個的好處。

是的,您需要一個負載平衡器。 當節點發生故障時,必須能夠將流量定向到活動節點。 集群只是確保會話在節點之間傳輸,因此任何節點都可以處理請求而不會中斷會話。

有關某些(非常基本的)選項和詳細信息,請參見“ 負載平衡”一章。 如果您希望使用其他負載均衡器,請參閱其文檔。

集群負載均衡是一個很好的概念,可以在全球范圍內提供更高的高可用性,可伸縮性和部署war文件。 有關更多詳細信息,請參見以下鏈接: https : //tomcat.apache.org/tomcat-8.0-doc/cluster-howto.html

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM