自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

tomcat負(fù)載均衡配置:集群和應(yīng)用部分的代碼

網(wǎng)絡(luò) 網(wǎng)絡(luò)優(yōu)化 網(wǎng)絡(luò)運(yùn)維
本文針對(duì)的是負(fù)載集群配置下的tomacat集群配置代碼的全部?jī)?nèi)容。通過(guò)完成下述的代碼配置,產(chǎn)能將整個(gè)tomcat負(fù)載均衡配置全部完成。

前文,我們介紹了tomcat負(fù)載均衡安裝和配置的內(nèi)容,前面主要針對(duì)的是負(fù)載均衡的配置代碼介紹。那么接下來(lái),就是針對(duì)于tomcat集群配置的代碼內(nèi)容,之后的應(yīng)用配置也做了簡(jiǎn)要的敘述。

◆tomcat集群配置

(1)負(fù)載均衡配置的條件下配置tomcat集群

(2)分別修改三個(gè)tomcat的配置文件conf/server.xml,修改內(nèi)容如下

修改前

  1. <!--   
  2. <Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster" 
  3.          managerClassName="org.apache.catalina.cluster.session.DeltaManager" 
  4.          expireSessionsOnShutdown="false" 
  5.          useDirtyFlag="true" 
  6.          notifyListenersOnReplication="true">  
  7.  
  8.     <Membership   
  9.         className="org.apache.catalina.cluster.mcast.McastService" 
  10.         mcastAddr="228.0.0.4" 
  11.         mcastPort="45564" 
  12.         mcastFrequency="500" 
  13.         mcastDropTime="3000"/>  
  14.  
  15.     <Receiver   
  16.         className="org.apache.catalina.cluster.tcp.ReplicationListener" 
  17.         tcpListenAddress="auto" 
  18.         tcpListenPort="4001" 
  19.         tcpSelectorTimeout="100" 
  20.         tcpThreadCount="6"/>  
  21.  
  22.     <Sender  
  23.         className="org.apache.catalina.cluster.tcp.ReplicationTransmitter" 
  24.         replicationMode="pooled" 
  25.         ackTimeout="5000"/>  
  26.  
  27.     <Valve className="org.apache.catalina.cluster.tcp.ReplicationValve" 
  28.            filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;"/>  
  29.              
  30.     <Deployer className="org.apache.catalina.cluster.deploy.FarmWarDeployer" 
  31.               tempDir="/tmp/war-temp/" 
  32.               deployDir="/tmp/war-deploy/" 
  33.               watchDir="/tmp/war-listen/" 
  34.               watchEnabled="false"/>  
  35.                 
  36.     <ClusterListener className="org.apache.catalina.cluster.session.ClusterSessionListener"/>  
  37. </Cluster>  
  38. -->    

#p#修改后

  1. <!-- modify by whh -->  
  2. <Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster" 
  3.          managerClassName="org.apache.catalina.cluster.session.DeltaManager" 
  4.          expireSessionsOnShutdown="false" 
  5.          useDirtyFlag="true" 
  6.          notifyListenersOnReplication="true">  
  7.  
  8.     <Membership   
  9.         className="org.apache.catalina.cluster.mcast.McastService" 
  10.         mcastAddr="228.0.0.4" 
  11.         mcastPort="45564" 
  12.         mcastFrequency="500" 
  13.         mcastDropTime="3000"/>  
  14.  
  15.     <Receiver   
  16.         className="org.apache.catalina.cluster.tcp.ReplicationListener" 
  17.         tcpListenAddress="auto" 
  18.         tcpListenPort="4001" 
  19.         tcpSelectorTimeout="100" 
  20.         tcpThreadCount="6"/>  
  21.  
  22.     <Sender  
  23.         className="org.apache.catalina.cluster.tcp.ReplicationTransmitter" 
  24.         replicationMode="pooled" 
  25.         ackTimeout="5000"/>  
  26.  
  27.     <Valve className="org.apache.catalina.cluster.tcp.ReplicationValve" 
  28.            filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;"/>  
  29.              
  30.     <Deployer className="org.apache.catalina.cluster.deploy.FarmWarDeployer" 
  31.               tempDir="/tmp/war-temp/" 
  32.               deployDir="/tmp/war-deploy/" 
  33.               watchDir="/tmp/war-listen/" 
  34.               watchEnabled="false"/>  
  35.                 
  36.     <ClusterListener className="org.apache.catalina.cluster.session.ClusterSessionListener"/>  
  37. </Cluster>  
  38. !-- modify by whh -->   

將集群配置選項(xiàng)的注釋放開(kāi)即可,如上。

(3)重啟三個(gè)tomcat。到此負(fù)載均衡配置下tomcat的集群已配置完成。#p#

◆應(yīng)用配置

對(duì)于要進(jìn)行負(fù)載和集群的的tomcat目錄下的webapps中的應(yīng)用中的WEB-INF中的web.xml文件要添加如下一句負(fù)載均衡配置

  1. <distributable/> 

配置前

  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">  
  3.   <display-name>TomcatDemo</display-name>  
  4. </web-app> 

配置后

  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">  
  3.   <display-name>TomcatDemo</display-name>  
  4.    <distributable/>  
  5. </web-app> 

 

責(zé)任編輯:佟健 來(lái)源: 互聯(lián)網(wǎng)
相關(guān)推薦

2010-04-20 22:19:29

tomcat負(fù)載均衡配

2010-04-22 16:31:09

配置網(wǎng)絡(luò)負(fù)載均衡

2014-07-28 11:37:49

NginxTomcat

2010-05-06 15:04:51

Tomcat負(fù)載均衡

2010-04-22 10:09:28

負(fù)載均衡器

2010-05-06 15:24:35

Tomcat負(fù)載均衡

2010-04-22 16:24:42

配置網(wǎng)絡(luò)負(fù)載均衡

2010-04-20 21:27:28

tomcat負(fù)載均衡配

2010-04-21 12:28:50

Oracle負(fù)載均衡

2019-05-28 15:05:10

NginxTomcat負(fù)載均衡

2010-04-28 11:35:25

集群負(fù)載均衡

2010-04-23 10:03:42

tomcat負(fù)載均衡技術(shù)

2018-09-13 08:47:09

Tomcat負(fù)載均衡服務(wù)器

2020-03-11 19:38:39

Tomcat負(fù)載均衡配置

2010-04-27 13:20:38

負(fù)載均衡集群

2019-12-24 14:28:00

KeepalivedNginxTomcat

2010-04-28 11:59:52

集群負(fù)載均衡

2010-04-22 11:47:58

集群負(fù)載均衡

2010-04-22 13:56:51

集群負(fù)載均衡

2010-09-15 14:50:57

集群負(fù)載均衡Tomcat
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)