亚洲免费在线-亚洲免费在线播放-亚洲免费在线观看-亚洲免费在线观看视频-亚洲免费在线看-亚洲免费在线视频

Tomcat的server.xml配置節點簡介

系統 1806 0

?

Tomcat的server.xml配置節點簡介

?

tomcat 的server.Xml 中的各個節點

Server 節點:
  Server 代表整個Catalina servlet 容器。在server.xml 配置文件中必須是頂層元素且唯一,給它配置的屬性代表整個容器的屬性。

Service 節點:
  service 由連接器connector 和共享的處理引擎(Engine)。

Connector 節點:
  Connector 分為http connector 和ajp3 connector,http connector 用 Http/1.1 協議 Connector 接偵聽來自客戶端瀏覽器的http 請求,此時tomcat 作為獨立的web 服務器;ajp3 connector用ajp3 協議偵聽來自其它Web 服務器的請求,此時tomcat 只作為servlet 容器。

Engine 節點:
  處理引擎(Engine)代表一個Service 所屬的請求處理機,它接受所有連接器傳遞過來的客戶端請求,將處理結果返回給連接器,由連接器將最終響應返回給客戶端。Engine 必須配置在Service 組件下。處理引擎下 可以配置多個虛擬主機(Virtual Host),每個虛擬主機都有一個域名。當處理引擎獲得一個請求時,它把該請求匹配到某個虛擬主機上,把請求交給該虛擬主機來處理。處理引擎有一個默認虛擬主機,當請求無法匹配到任何一個虛擬主機上時,交給默認虛擬主機來處理。

Host 節點:
  代表一個虛擬主機,每個虛擬主機和某個網絡域名(Domain Name)相匹配。每個虛擬主機下都可以部署(deploy)一個或者多個Web 應用程序(Web Application),每個Web 應用程序對應于一個Context,有一個Context path。當虛擬主機獲得一個請求時,將把該請求匹配到某個Context上,然后把該請求交給該Context來處理。匹配的方法是“最長匹配”,一個path=""的Context將成為該虛擬主機的默認Context。所有無法和其它Context的路徑名匹配的請求都將最終和該默認Context匹配。在許多情況下,系統管理員希望將多個網絡域名綁定到同一個虛擬主機,這就需要使用“主機別名”技術來實現。

Context節點:
  一個Context對應于一個Web應用程序,一個Web應用程序由一個或者多個Servlet組成。Context在創建的時候將根據配置文件$CATALINA_HOME/conf/web.xml 和$WebApp/Web-INF/web.xml 載入Servlet類。當Context獲得請求時,將在自己的映射表(mapping table)中尋找相匹配的Servlet類。如果找到,則執行該類,獲得請求的響應,并返回。

?

Cluster中的各個屬性節點

tomcat 集群各節點通過建立tcp 鏈接來完成Session的拷貝,拷貝有同步和異步兩種模式。在同步模式下,對客戶端的響應必須在Session拷貝到其他節點完成后進行;異步模式無需等待Session拷貝完成就可響應。異步模式更高效,但是同步模式可靠性更高。同步異步模式由channelSendOptions參數控制,默認值是8,為異步模式,4是同步模式。在異步模式下,可以通過加上拷貝確認(Acknowledge)來提高可靠性,此時channelSendOptions設為10。

Manager節點:
  用來在節點間拷貝Session,默認使用DeltaManager,DeltaManager采用的一種all-to-all的工作方式,即集群中的節點會把Session數據向所有其他節點拷貝,而不管其他節點是否部署 了當前應 用。當集群中 的節點數 量很多并且部 署著不同 應用時,可以 使用BackupManager,BackManager僅向部署了當前應用的節點拷貝Session。但是到目前為止BackupManager并未經過大規模測試,可靠性不及DeltaManager。

Channel節點:
  負責對tomcat 集群的IO 層進行配置。Membership用于發現集群中的其他節點,這里的address用的是組播地址(Multicast address,),使用同一個組播地址和端口的多個節點同屬一個子集群,因此通過自定義組播地址和端口就可將一個大的tomcat 集群分成多個子集群。Receiver用于各個節點接收其他節點發送的數據,在默認配置下tomcat 會從4000-4100間依次選取一個可用的端口進行接收,自定義配置時,如果多個tomcat節點在一臺物理服務器上注意要使用不同的端口。Sender用于向其他節點發送數據,具體實現通過Transport配置,PooledParallelSender是從tcp 連接池中獲取連接,可以實現并行發送,即集群中的多個節點可以同時向其他所有節點發送數據而互不影響。Interceptor有點類似下面將要解釋的Valve,起到一個閥門的作用,在數據到達目的節點前進行檢測或其他操作,如TcpFailureDetector用于檢測在數據的傳輸過程中是否發生了tcp 錯誤。

Valve節點:
  用于在節點向客戶端響應前進行檢測或進行某些操作,ReplicationValve就是用于用于檢測當前的響應是否涉及Session數據的更新,如果是則啟動Session拷貝操作,filter用于過濾 請求,如客戶端對圖片,css,js 的請求就不會涉及Session,因此不需檢測,默認狀態下不進行過濾,監測所有的響應。JvmRouteBinderValve會在前端的Apache mod_jk發生錯誤時 保證同一客戶端的請求發送到集群的同一個節點,tomcat 官方文檔并未解釋如何實現這一點。?

Deployer節點:
  用于集群的farm 功能,監控應用中文件的更新,以保證集群中所有節點應用的一致性,如某個用戶上傳文件到集群中某個節點的應用程序目錄下,Deployer會監測到這一操作并把這一文件拷貝到集群中其他節點相同應用的對應目錄下以保持所有應用的一致。這是一個相當強大的功能,不過很遺憾,tomcat 集群目前并不能做到這一點,開發人員正在努力實現它,這里的配置只是預留了一個接口。

Listener節點:
  用于跟蹤集群中節點發出和收到的數據,也有點類似Valve的功能。

一個樣例,直接貼上來:

      
        <?
      
      
        xml version='1.0' encoding='utf-8'
      
      
        ?>
      
      
        <!--
      
      
        

  Licensed to the Apache Software Foundation (ASF) under one or more

  contributor license agreements.  See the NOTICE file distributed with

  this work for additional information regarding copyright ownership.

  The ASF licenses this file to You under the Apache License, Version 2.0

  (the "License"); you may not use this file except in compliance with

  the License.  You may obtain a copy of the License at



      http://www.apache.org/licenses/LICENSE-2.0



  Unless required by applicable law or agreed to in writing, software

  distributed under the License is distributed on an "AS IS" BASIS,

  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

  See the License for the specific language governing permissions and

  limitations under the License.


      
      
        -->
      
      
        <!--
      
      
         Note:  A "Server" is not itself a "Container", so you may not

     define subcomponents such as "Valves" at this level.

     Documentation at /docs/config/server.html

 
      
      
        -->
      
      
        <
      
      
        Server 
      
      
        port
      
      
        ="8005"
      
      
         shutdown
      
      
        ="SHUTDOWN"
      
      
        >
      
      
        <!--
      
      
        APR library loader. Documentation at /docs/apr.html 
      
      
        -->
      
      
        <
      
      
        Listener 
      
      
        className
      
      
        ="org.apache.catalina.core.AprLifecycleListener"
      
      
         SSLEngine
      
      
        ="on"
      
      
        />
      
      
        <!--
      
      
        Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html 
      
      
        -->
      
      
        <
      
      
        Listener 
      
      
        className
      
      
        ="org.apache.catalina.core.JasperListener"
      
      
        />
      
      
        <!--
      
      
         Prevent memory leaks due to use of particular java/javax APIs
      
      
        -->
      
      
        <
      
      
        Listener 
      
      
        className
      
      
        ="org.apache.catalina.core.JreMemoryLeakPreventionListener"
      
      
        />
      
      
        <!--
      
      
         JMX Support for the Tomcat server. Documentation at /docs/non-existent.html 
      
      
        -->
      
      
        <
      
      
        Listener 
      
      
        className
      
      
        ="org.apache.catalina.mbeans.ServerLifecycleListener"
      
      
        />
      
      
        <
      
      
        Listener 
      
      
        className
      
      
        ="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
      
      
        />
      
      
        <!--
      
      
         Global JNDI resources

       Documentation at /docs/jndi-resources-howto.html

  
      
      
        -->
      
      
        <
      
      
        GlobalNamingResources
      
      
        >
      
      
        <!--
      
      
         Editable user database that can also be used by

         UserDatabaseRealm to authenticate users

    
      
      
        -->
      
      
        <
      
      
        Resource 
      
      
        name
      
      
        ="UserDatabase"
      
      
         auth
      
      
        ="Container"
      
      
        

              type
      
      
        ="org.apache.catalina.UserDatabase"
      
      
        

              description
      
      
        ="User database that can be updated and saved"
      
      
        

              factory
      
      
        ="org.apache.catalina.users.MemoryUserDatabaseFactory"
      
      
        

              pathname
      
      
        ="conf/tomcat-users.xml"
      
      
        />
      
      
        </
      
      
        GlobalNamingResources
      
      
        >
      
      
        <!--
      
      
         A "Service" is a collection of one or more "Connectors" that share

       a single "Container" Note:  A "Service" is not itself a "Container", 

       so you may not define subcomponents such as "Valves" at this level.

       Documentation at /docs/config/service.html

   
      
      
        -->
      
      
        <
      
      
        Service 
      
      
        name
      
      
        ="Catalina"
      
      
        >
      
      
        <!--
      
      
        The connectors can use a shared executor, you can define one or more named thread pools
      
      
        -->
      
      
        <!--
      
      
        

    <Executor name="tomcatThreadPool" namePrefix="catalina-exec-" 

        maxThreads="150" minSpareThreads="4"/>

    
      
      
        -->
      
      
        <!--
      
      
         A "Connector" represents an endpoint by which requests are received

         and responses are returned. Documentation at :

         Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)

         Java AJP  Connector: /docs/config/ajp.html

         APR (HTTP/AJP) Connector: /docs/apr.html

         Define a non-SSL HTTP/1.1 Connector on port 8080

    
      
      
        -->
      
      
        <
      
      
        Connector 
      
      
        port
      
      
        ="8080"
      
      
         protocol
      
      
        ="HTTP/1.1"
      
      
         

               connectionTimeout
      
      
        ="20000"
      
      
         

               redirectPort
      
      
        ="8443"
      
      
        />
      
      
        <!--
      
      
         A "Connector" using the shared thread pool
      
      
        -->
      
      
        <!--
      
      
        

    <Connector executor="tomcatThreadPool"

               port="8080" protocol="HTTP/1.1" 

               connectionTimeout="20000" 

               redirectPort="8443" />

    
      
      
        -->
      
      
        <!--
      
      
         Define a SSL HTTP/1.1 Connector on port 8443

         This connector uses the JSSE configuration, when using APR, the 

         connector should be using the OpenSSL style configuration

         described in the APR documentation 
      
      
        -->
      
      
        <!--
      
      
        

    <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"

               maxThreads="150" scheme="https" secure="true"

               clientAuth="false" sslProtocol="TLS" />

    
      
      
        -->
      
      
        <!--
      
      
         Define an AJP 1.3 Connector on port 8009 
      
      
        -->
      
      
        <
      
      
        Connector 
      
      
        port
      
      
        ="8009"
      
      
         protocol
      
      
        ="AJP/1.3"
      
      
         redirectPort
      
      
        ="8443"
      
      
        />
      
      
        <!--
      
      
         An Engine represents the entry point (within Catalina) that processes

         every request.  The Engine implementation for Tomcat stand alone

         analyzes the HTTP headers included with the request, and passes them

         on to the appropriate Host (virtual host).

         Documentation at /docs/config/engine.html 
      
      
        -->
      
      
        <!--
      
      
         You should set jvmRoute to support load-balancing via AJP ie :

    <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">         

    
      
      
        -->
      
      
        <
      
      
        Engine 
      
      
        name
      
      
        ="Catalina"
      
      
         defaultHost
      
      
        ="localhost"
      
      
        >
      
      
        <!--
      
      
        For clustering, please take a look at documentation at:

          /docs/cluster-howto.html  (simple how to)

          /docs/config/cluster.html (reference documentation) 
      
      
        -->
      
      
        <!--
      
      
        

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

      
      
      
        -->
      
      
        <!--
      
      
         The request dumper valve dumps useful debugging information about

           the request and response data received and sent by Tomcat.

           Documentation at: /docs/config/valve.html 
      
      
        -->
      
      
        <!--
      
      
        

      <Valve className="org.apache.catalina.valves.RequestDumperValve"/>

      
      
      
        -->
      
      
        <!--
      
      
         This Realm uses the UserDatabase configured in the global JNDI

           resources under the key "UserDatabase".  Any edits

           that are performed against this UserDatabase are immediately

           available for use by the Realm.  
      
      
        -->
      
      
        <
      
      
        Realm 
      
      
        className
      
      
        ="org.apache.catalina.realm.UserDatabaseRealm"
      
      
        

             resourceName
      
      
        ="UserDatabase"
      
      
        />
      
      
        <!--
      
      
         Define the default virtual host

           Note: XML Schema validation will not work with Xerces 2.2.

       
      
      
        -->
      
      
        <
      
      
        Host 
      
      
        name
      
      
        ="localhost"
      
      
          appBase
      
      
        ="webapps"
      
      
        

            unpackWARs
      
      
        ="true"
      
      
         autoDeploy
      
      
        ="true"
      
      
        

            xmlValidation
      
      
        ="false"
      
      
         xmlNamespaceAware
      
      
        ="false"
      
      
        >
      
      
        <!--
      
      
         SingleSignOn valve, share authentication between web applications

             Documentation at: /docs/config/valve.html 
      
      
        -->
      
      
        <!--
      
      
        

        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />

        
      
      
        -->
      
      
        <!--
      
      
         Access log processes all example.

             Documentation at: /docs/config/valve.html 
      
      
        -->
      
      
        <!--
      
      
        

        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"  

               prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>

        
      
      
        -->
      
      
        </
      
      
        Host
      
      
        >
      
      
        </
      
      
        Engine
      
      
        >
      
      
        </
      
      
        Service
      
      
        >
      
      
        </
      
      
        Server
      
      
        >
      
    

?

Tomcat的server.xml配置節點簡介


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 99久热成人精品视频 | 久久精品国产福利国产秒 | 久久精品99视频 | www.91自拍| 久久日韩在线 | 在线不卡视频 | 91破解版在线 | 亚洲 | 国产成人a一在线观看 | 奇米久久 | 欧美视频三区 | 手机看片国产精品 | 成人影院免费在线观看 | 国产亚洲精品热视频在线观看 | 欧美成人免费视频a | 中文国产日韩欧美视频 | 91精品免费观看 | 九九99热久久精品在线9 | 亚洲精美视频 | 久热只有精品 | 欧美一区二区三 | 我要看免费毛片 | 日韩欧美色视频在线观看 | 精品综合久久久久久98 | 国产精品久久久久天天影视 | 国产精品香蕉成人网在线观看 | 高清午夜毛片 | 一级日本高清视频免费观看 | 亚洲国产综合精品 | 中文字幕在线一区二区三区 | 国产精品香蕉在线一区 | 亚洲欧美一区二区久久香蕉 | 精品一区二区乱码久久乱码 | 中文字幕最新中文字幕中文字幕 | 伊色综合久久之综合久久 | 九九热免费观看 | 久久精品道一区二区三区 | 一级爱爱片一级毛片-一毛 一级白嫩美女毛片免费 | 一级高清毛片 | 国产精品爱久久久久久久三级 | 激情综合色综合啪啪开心 | 久久永久免费中文字幕 |