<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    隨筆-153  評論-235  文章-19  trackbacks-0
    參照:  http://www.360doc.com/showWeb/0/0/207707.aspx

    環境:
    Tomcat 5.5.20
    Apache 2.2.3


    1.機器A 里有TomcatA\webapps\Test目錄, 機器B里TomcatB\webapps\Test目錄。其web.xml文件一樣,兩個都在</web-app>之前加上<distributable/>

    2.兩個Tomcat\conf\server.xml的如下內容去掉注釋,沒有就在</Host>之前加上去:


    <Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
                     managerClassName
    ="org.apache.catalina.cluster.session.DeltaManager"
                     expireSessionsOnShutdown
    ="false"
                     useDirtyFlag
    ="true"
                     notifyListenersOnReplication
    ="true">

                
    <Membership 
                    
    className="org.apache.catalina.cluster.mcast.McastService"
                    mcastAddr
    ="228.0.0.4"
                    mcastPort
    ="45564"
                    mcastFrequency
    ="500"
                    mcastDropTime
    ="3000"/>

                
    <Receiver 
                    
    className="org.apache.catalina.cluster.tcp.ReplicationListener"
                    tcpListenAddress
    ="auto"
                    tcpListenPort
    ="4001"
                    tcpSelectorTimeout
    ="100"
                    tcpThreadCount
    ="6"/>

                
    <Sender
                    
    className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
                    replicationMode
    ="pooled"
                    ackTimeout
    ="15000"
                    waitForAck
    ="true"/>

                
    <Valve className="org.apache.catalina.cluster.tcp.ReplicationValve"
                       filter
    =".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;"/>
                       
                
    <Deployer className="org.apache.catalina.cluster.deploy.FarmWarDeployer"
                          tempDir
    ="/tmp/war-temp/"
                          deployDir
    ="/tmp/war-deploy/"
                          watchDir
    ="/tmp/war-listen/"
                          watchEnabled
    ="false"/>
                          
                
    <ClusterListener className="org.apache.catalina.cluster.session.ClusterSessionListener"/>
            
    </Cluster>


    3.接下來配置Apache\conf\httpd.conf
    其中這三個去掉注釋:
    LoadModule proxy_module modules/mod_proxy.so
    LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
    LoadModule proxy_http_module modules/mod_proxy_http.so


    末尾加上:
    ProxyRequests Off

    ProxyPass /helloworld balancer://mycluster stickysession
    =jsessionid nofailover=On

    <Proxy balancer://mycluster>
    BalancerMember http://
    192.168.0.100:8080
    BalancerMember http://
    192.168.0.101:8080
    </Proxy>

    <Location /balancer-manager>
    SetHandler balancer-manager
    Order Deny
    ,Allow
    Deny from all
    Allow from all
    </Location>

    <Location /server-status>
    SetHandler server-status
    Order Deny
    ,Allow
    Deny from all
    Allow from all
    </Location>


    說明:
    ProxyPass /helloworld balancer://mycluster stickysession=jsessionid nofailover=On
    <Proxy balancer://mycluster>
    BalancerMember http://192.168.0.100:8080
    BalancerMember http://192.168.0.101:8080
    </Proxy>
    ProxyPass為代理轉發的Url,即將所有訪問/helloworld的請求轉發到群集balancer://mycluster
    BalancerMember為群集的成員,即群集服務器AB,負載均衡服務器會根據均衡規則來將請求轉發給BalancerMember。


    4.測試頁面,
    TomcatA\webapps\Test\index.html內容如下:
    <html>
    <head><title>Tomcat 5.5.20 群集1</title></head>

    <body>
    <center>Tomcat 1號機
    </center>
    </body>
    </html>


    TomcatB\webapps\Test\index.html內容如下:
    <html>
    <head><title>Tomcat 5.5.20 群集2</title></head>

    <body>
    <center>Tomcat 2號機在TomcatB機上
    </center>
    </body>
    </html>


    啟動TomcatA和TomcatB,再啟動Apache
    http://localhost/helloworld/Test/index.html
    后有出現上面兩個頁面的任一個說明配置成功。
    不斷刷新,這個頁面不斷交替。

    :)
    posted on 2007-03-15 16:59 流浪汗 閱讀(1581) 評論(0)  編輯  收藏 所屬分類: Tomcat
    主站蜘蛛池模板: 看Aⅴ免费毛片手机播放| 亚洲人成在线播放网站岛国| 亚洲日韩av无码中文| 美丽的姑娘免费观看在线播放| 亚洲成AV人片在线观看无码| 99在线热播精品免费99热| 久久亚洲国产中v天仙www| 日韩电影免费在线观看中文字幕| 亚洲中文字幕在线观看| 成人性生交大片免费看中文| 国产A在亚洲线播放| 中文字幕亚洲免费无线观看日本 | 日本片免费观看一区二区| 久久亚洲精品成人AV| 四虎永久在线观看免费网站网址 | 免费吃奶摸下激烈视频| 人体大胆做受免费视频| 亚洲国产第一站精品蜜芽| 免费无码成人AV在线播放不卡| 亚洲xxxxxx| 免费人成视频在线观看不卡| 91免费国产视频| 亚洲精品第五页中文字幕| 好吊妞视频免费视频| 二级毛片免费观看全程| 久久噜噜噜久久亚洲va久| 99久久免费国产精品特黄| 亚洲国产成人AV网站| 亚洲色成人网站WWW永久| 久久久久av无码免费网| 极品色天使在线婷婷天堂亚洲| 亚洲人成伊人成综合网久久久| 69式互添免费视频| 国产在亚洲线视频观看| 亚洲精品高清国产一久久| 午夜电影免费观看| 四虎影视无码永久免费| 亚洲乱码在线卡一卡二卡新区 | 亚洲美免无码中文字幕在线| 午夜dj免费在线观看| 搡女人免费免费视频观看|