您的位置:首页 > 运维架构 > Tomcat

TomCat配置文件翻译

2005-12-28 21:17 399 查看
<!-- Example Server Configuration File -->

<!-- 配置文件实例-->

<!-- Note that component elements are nested corresponding to their

parent-child relationships with each other -->

<!--注意组件元素对于父子关系是相互嵌套的 -->

<!-- A "Server" is a singleton element that represents the entire JVM,

which may contain one or more "Service" instances. The Server

listens for a shutdown command on the indicated port.

Note: A "Server" is not itself a "Container", so you may not

define subcomponents such as "Valves" or "Loggers" at this level.

-->

<!-- 一个"Server" 是唯一的描述整个JVM的元素,它可以包含一个或多个Service

实例。Server 在一个设定的端口监听关闭(shutdown)命令。

注意:一个"Server"节点不是一个自己的容器,因此在这个级别上你不可以

定义一个子组件比如:"Valves" 或"Loggers".

-->

<Server port="8005" shutdown="SHUTDOWN">

<!-- Comment these entries out to disable JMX MBeans support used for the administration web application -->

<!-- 注释这些行可以禁止用于支持管理者的web程序的JMX MBeans-->

<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />

<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />

<Listener className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/>

<!-- Global JNDI resources -->

<!-- 全局 JNDI 资源-->

<GlobalNamingResources>

<!-- Test entry for demonstration purposes -->

<!-- 范例用途测试入口-->

<Environment name="simpleValue" type="java.lang.Integer" value="30"/>

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

UserDatabaseRealm to authenticate users -->

<!-- 编辑可以用于UserDatabase节点值去鉴别用户的用户数据库-->

<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" (and therefore the web applications visible

within that Container). Normally, that Container is an "Engine",

but this is not required.

Note: A "Service" is not itself a "Container", so you may not

define subcomponents such as "Valves" or "Loggers" at this level.

-->

<!--

一个Service 是一个或多个连接器集合它共享一个单独的容器(因此Web程序在容

器内是可见的.)通常,容器是一个"Engine",但不是必需的.

注意:一个Service不能是自身的容器,因此你不能对他定义子组件比如"Valves"

或"Loggers".

-->

<!-- Define the Tomcat Stand-Alone Service -->

<!-- 定义Tomcat 单一的服务-->

<Service name="Catalina">

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

and responses are returned. Each Connector passes requests on to the

associated "Container" (normally an Engine) for processing.

By default, a non-SSL HTTP/1.1 Connector is established on port 8080.

You can also enable an SSL HTTP/1.1 Connector on port 8443 by

following the instructions below and uncommenting the second Connector

entry. SSL support requires the following steps (see the SSL Config

HOWTO in the Tomcat 5 documentation bundle for more detailed SSL)

instructions):

* If your JDK version 1.3 or prior, download and install JSSE 1.0.2 or

later, and put the JAR files into "$JAVA_HOME/jre/lib/ext".

* Execute:

%JAVA_HOME%/bin/keytool -genkey -alias tomcat -keyalg RSA (Windows)

$JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA (Unix)

with a password value of "changeit" for both the certificate and

the keystore itself.

By default, DNS lookups are enabled when a web application calls:

request.getRemoteHost(). This can have an adverse impact on

performance, so you can disable it by setting the

"enableLookups" attribute to "false". When DNS lookups are disabled,

request.getRemoteHost() will return the String version of the

IP address of the remote client.

-->

<!--

一个"Connector" 描述了一个请求被接受以及回应被传递的端点.每个连接器为

处理进程传递和请求关联的容器. 默认的,一个 non-SSL HTTP/1.1 连接器是建

立在8080端口上的. 你也可以通过使用下面的格式和反注释第二个连接器入口

把它建立在8443端口上. 支持SSL需要下面的步骤(参见:Tomcat 文件包上的如

何在Tomcat 5上配置 .如果你的JDK版本是1.3或更早的,请下载JSSE 1.0.2

或更高,然后把JAR文件放在"$JAVA_HOME/jre/lib/ext".

执行以下命令通常,当一个Web程序调用:request.getRemoteHost()DNS查就变成活动的

在执行的时候它可能有相反的效果.所以你可以通过设置enableLookups的属

性为"false"禁止它 DNS查找禁止的时候,request.getRemoteHost()会返回一

个远程客户端IP地址的字符串.

-->

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

<!-- 在8080端口定义一个non-SSL HTTP/1.1 连接器-->

<Connector port="80" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" maxSpareThreads="75"

enableLookups="false" redirectPort="8443" acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" />

<!-- Note : To disable connection timeouts, set connectionTimeout value

to 0 -->

<!--注意:设置connectionTimeout的值可以防止连接超时 -->

<!-- Note : To use gzip compression you could set the following properties :

     注意:使用gzip压缩你应该设置以下属性

compression="on"

compressionMinSize="2048"

noCompressionUserAgents="gozilla, traviata"

compressableMimeType="text/html,text/xml"

-->

  

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

<!-- 在8443端口定义一个non-SSL HTTP/1.1 连接器-->

<!--

<Connector port="8443" maxHttpHeaderSize="8192"

maxThreads="150" minSpareThreads="25" maxSpareThreads="75"

enableLookups="false" disableUploadTimeout="true"

acceptCount="100" scheme="https" secure="true"

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

-->

<!-- Define an AJP 1.3 Connector on port 8009 -->

  <!-- 在8009端口定义一个AJP 1.3 连接器-->

<Connector port="8009"

enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />

<!-- Define a Proxied HTTP/1.1 Connector on port 8082 -->

  <!-- 在8082端口定义一个Proxied HTTP/1.1 连接器-->

<!-- See proxy documentation for more information about using this. -->

<!-- 更多信息可以参看proxy文档-->

<!--

<Connector port="8082"

maxThreads="150" minSpareThreads="25" maxSpareThreads="75"

enableLookups="false" acceptCount="100" connectionTimeout="20000"

proxyPort="80" disableUploadTimeout="true" />

-->

<!-- 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). -->

  <!-- 一个Engine描述了每个请求进程的入口点(Catalina内)

    Engine实现了Tomcat 单独分析每个请求的HTTP头和把他们传递给适当的主机(虚拟主机)

   -->

<!-- You should set jvmRoute to support load-balancing via AJP ie :

   你应该设置jvmRoute以便支持load-balancing via AJP 比如:

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

-->

<!-- Define the top level container in our container hierarchy -->

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

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

the request headers and cookies that were received, and the response

headers and cookies that were sent, for all requests received by

this instance of Tomcat. If you care only about requests to a

particular virtual host, or a particular application, nest this

element inside the corresponding <Host> or <Context> entry instead.

请求卸载装置的阈通过TomCat的实例为所有收到的请求把有用的关于请求头

的调式信息和他们收到的cookei,以及发送的头和接收的cookie dump,

如果你仅仅关心一个虚拟主机的细节或者应用细节,可以把这些嵌入到

<Host> or <Context>入口中

For a similar mechanism that is portable to all Servlet 2.4

containers, check out the "RequestDumperFilter" Filter in the

example application (the source for this filter may be found in

"$CATALINA_HOME/webapps/examples/WEB-INF/classes/filters").

你可以通过在事例程序中检查 RequestDumperFilter过滤器得到一个

对于 Servlet 2.4 容器类似的便携式机制。(你可以在"$CATALINA_HOME/webapps/

examples/WEB-INF/classes/filters" 找到过滤器资源.

Request dumping is disabled by default. Uncomment the following

默认的请求dump是禁止的。取消注释可以使他可用。

element to enable it. -->

<!--

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

-->

<!-- Because this Realm is here, an instance will be shared globally -->

<!-- 因为节点在这里,所以实例将是全局共享的 -->

<!-- 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. -->

<!-- 节点在全局JNDI资源中通过健UserDatabase使用UserDatabase配置在

任何通过使用节点 UserDatabase的修改立即生效

->

<Realm className="org.apache.catalina.realm.UserDatabaseRealm"

resourceName="UserDatabase"/>

<!-- Comment out the old realm but leave here for now in case we

need to go back quickly -->

<!--

除了这个地方注释旧的节点以防万一,我们可以尽快恢复原来的配置

-->

<!--

<Realm className="org.apache.catalina.realm.MemoryRealm" />

-->

<!-- Replace the above Realm with one of the following to get a Realm

stored in a database and accessed via JDBC -->

<!-- 下面一个数据库保存和访问JDBC的节点可以替换上面的节点。

-->

<!--

<Realm className="org.apache.catalina.realm.JDBCRealm"

driverName="org.gjt.mm.mysql.Driver"

connectionURL="jdbc:mysql://localhost/authority"

connectionName="test" connectionPassword="test"

userTable="users" userNameCol="user_name" userCredCol="user_pass"

userRoleTable="user_roles" roleNameCol="role_name" />

-->

<!--

<Realm className="org.apache.catalina.realm.JDBCRealm"

driverName="oracle.jdbc.driver.OracleDriver"

connectionURL="jdbc:oracle:thin:@ntserver:1521:ORCL"

connectionName="scott" connectionPassword="tiger"

userTable="users" userNameCol="user_name" userCredCol="user_pass"

userRoleTable="user_roles" roleNameCol="role_name" />

-->

<!--

<Realm className="org.apache.catalina.realm.JDBCRealm"

driverName="sun.jdbc.odbc.JdbcOdbcDriver"

connectionURL="jdbc:odbc:CATALINA"

userTable="users" userNameCol="user_name" userCredCol="user_pass"

userRoleTable="user_roles" roleNameCol="role_name" />

-->

<!-- Define the default virtual host

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

-->

<!-- 定义默认的虚拟主机

注意:XMl Schema 验证无法和Xerces 2.2工作。

-->

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

unpackWARs="true" autoDeploy="true"

xmlValidation="false" xmlNamespaceAware="false">

<Context path="/mov" docBase="D:/InetPub/wwwroot/mov" debug="0" reload="true"

reloadable="true" crossContext="true" />

<!-- Defines a cluster for this node,

本节点定义一个集群

By defining this element, means that every manager will be changed.

通过定义下面的元素,意味着每个管理者都将改变。

So when running a cluster, only make sure that you have webapps in there

因此当运行一个集群时候,必须确认在这里你有需要集群的webapps,同时删

that need to be clustered and remove the other ones.

除其他的

A cluster has the following parameters:

一个集群必须有以下参数:

className = the fully qualified name of the cluster class

className = 完整的集群类名

name = a descriptive name for your cluster, can be anything

name = 你集群的描述名称,可以是任意的

mcastAddr = the multicast address, has to be the same for all the nodes

mcastAddr =多点传送地址,所有节点必须是相同的

mcastPort = the multicast port, has to be the same for all the nodes

mcastPort=多点传送端口,,所有节点必须是相同的

mcastBindAddr = bind the multicast socket to a specific address

mcastBindAddr =为多点传送Socket邦定一个专用地址

mcastTTL = the multicast TTL if you want to limit your broadcast

mcastTTL =为多点传送TTL如果你想限制你的broadcast

mcastSoTimeout = the multicast readtimeout

mcastSoTimeout =为多点传送读取过期设定

mcastFrequency = the number of milliseconds in between sending a "I'm alive" heartbeat

mcastFrequency =传送一个活动心跳信息的单位为毫秒的数字

mcastDropTime = the number a milliseconds before a node is considered "dead" if no heartbeat is received

mcastDropTime =如果没有心跳收到就认为一个节点以及死亡的被单位为毫秒的数字

tcpThreadCount = the number of threads to handle incoming replication requests, optimal would be the same amount of threads as nodes

tcpThreadCount =处理请求复制线程数,缺省的和节点数总和一致

tcpListenAddress = the listen address (bind address) for TCP cluster request on this host,

in case of multiple ethernet cards.

auto means that address becomes

InetAddress.getLocalHost().getHostAddress()

tcpListenAddress =在主机上坚挺TCP集群请求的的地址

以防有多个网卡。

自动意味着地址成

InetAddress.getLocalHost().getHostAddress()

tcpListenPort = the tcp listen port

tcp 监听端口

tcpSelectorTimeout = the timeout (ms) for the Selector.select() method in case the OS

has a wakup bug in java.nio. Set to 0 for no timeout

Selector.select()超时设万一系统在java.nio.有睡眠bug则设置

为0以便永不过期

printToScreen = true means that managers will also print to std.out

true 意味着管理者用std.out打印

expireSessionsOnShutdown = true means that

真意味着:

useDirtyFlag = true means that we only replicate a session after setAttribute,removeAttribute has been called.

true意味着在setAttribute,removeAttribute被调用后,我们仅仅可以复制一个session 。

false means to replicate the session after each request.

false 意味着每个请求之后都可以复制Session

false means that replication would work for the following piece of code: (only for

SimpleTcpReplicationManager)

false意味着复制可以工作在相面的代码片断中(仅用于SimpleTcpReplicationManager

<%

HashMap map = (HashMap)session.getAttribute("map");

map.put("key","value");

%>

replicationMode = can be either 'pooled', 'synchronous' or 'asynchronous'.

可以是pooled', 'synchronous' or 'asynchronous'.

* Pooled means that the replication happens using several sockets in a synchronous

Pooled 意味着复制在通过一个同步的方式使用服务端sockets时候发生。

way. Ie, the data gets replicated, then the request return. This is the same as the

数据开始复制,请求返回。这个“synchronous”设置相同除了他是使用Socket池外。

'synchronous' setting except it uses a pool of sockets, hence it is multithreaded.

因此他是多线程的。

This is the fastest and safest configuration. To use this, also increase the nr of

这是最快和安全的配置。使用他,也增加处理复制的TCP线程的nr

tcp threads that you have dealing with replication.

* Synchronous means that the thread that executes the request, is also the

Synchronous

执行请求的线程也是复制数据到别的节点的线程,除非所有节点收到

thread the replicates the data to the other nodes, and will not return until all

消息否则不返回。

nodes have received the information. * Asynchronous means that there is a specific ' sender' thread for each cluster node,

Asynchronous 就是有每个集群节点有一个具体的"发送者",

so the request thread will queue the replication request into a "smart" queue,

所以请求线程将排列复制请求到一个智能的队列中

and then return to the client.

接着返回客户端

The "smart" queue is a queue where when a session is added to the queue, and the sam

智能的 队列是一个队列,当一个session被增加到队列中,同样的Session

session already exists in the queue from a previous request, that session will be replaced

就已经在队列的前一个请求中存在,这个session将被队列中的复制好的两个请求替代。

in the queue instead of replicating two requests. This almost never happens, unless

这决不会发生除非有一个很长事件的网络延迟。

there is a large network delay.

-->

<!--

When configuring for clustering, you also add in a valve to catch all the requests

当为集群做配置的时候,你应该增加一个valve去捕获所有进入的请求

coming in, at the end of the request, the session may or may not be replicated.

在全球结束后,session可能或不可能被复制的。

A session is replicated if and only if all the conditions are met:

一个session被复制仅但下面条件符合才可以:

1. useDirtyFlag is true or setAttribute or removeAttribute has been called AND

1。useDirtyFlag 设置为true或setAttribute或removeAttribute被调用

2. a session exists (has been created)

2。一个session存在(已经被创建)

3. the request is not trapped by the "filter" attribute

3。请求没有被filter属性捕获

The filter attribute is to filter out requests that could not modify the session,

filter属性是过滤那些不能修改的Session请求,

hence we don't replicate the session after the end of this request.

因此我们不能在请求结束之后复制session。

The filter is negative, ie, anything you put in the filter, you mean to filter out,

filter是消极的任何过滤的东西都意味者过滤

ie, no replication will be done on requests that match one of the filters.

在匹配过滤器的请求中没有复制会被进行

The filter attribute is delimited by ;, so you can't escape out ; even if you wanted to.

过滤器的属性是限定的;,所以即使你想你也不能跳过,

filter=".*/.gif;.*/.js;" means that we will not replicate the session after requests with the URI

filter=".*/.gif;.*/.js;"意思是我们不能在以 。 gif和.js结尾的url请求中复制被截取的session的请求

ending with .gif and .js are intercepted.

The deployer element can be used to deploy apps cluster wide.

配置元素用于配置程序集群

Currently the deployment only deploys/undeploys to working members in the cluster

普便的配置仅仅配置/取消配置集群中的正工作的成员。

so no WARs are copied upons startup of a broken node.

因此在一个启动了的坏节点上不会有WARs被拷贝

The deployer watches a directory (watchDir) for WAR files when watchEnabled="true"

当watchEnabled="true"时配置为WAR监视一个目录(watchDir)

When a new war file is added the war gets deployed to the local instance,

一个新的war文件被加入本地实例配置的war中时,接着在集群中配置到别的实例中

and then deployed to the other instances in the cluster.

When a war file is deleted from the watchDir the war is undeployed locally

一个war被从watchDir删除,War将从配置的war中删除

and cluster wide

-->

<!--

<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"/>

<Valve className="org.apache.catalina.cluster.tcp.ReplicationValve"

filter=".*/.gif;.*/.js;.*/.jpg;.*/.htm;.*/.html;.*/.txt;"/>

<Deployer className="org.apache.catalina.cluster.deploy.FarmWarDeployer"

tempDir="/tmp/war-temp/"

deployDir="/tmp/war-deploy/"

watchDir="/tmp/war-listen/"

watchEnabled="false"/>

</Cluster>

-->

<!-- Normally, users must authenticate themselves to each web app

individually. Uncomment the following entry if you would like

a user to be authenticated the first time they encounter a

resource protected by a security constraint, and then have that

user identity maintained across *all* web applications contained

in this virtual host. -->

<!-- 通常,用户必须鉴别他们自己的每个Web程序.如果当他们遇到一个被保护的

使用了安全约束的资源和有一致的通过*all* 包含在虚拟主机中web程序,

你想用户在第一时间被认证,则取消下面入口的注释,

-->

<!--

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

-->

<!-- Access log processes all requests for this virtual host. By

default, log files are created in the "logs" directory relative to

$CATALINA_HOME. If you wish, you can specify a different

directory with the "directory" attribute. Specify either a relative

(to $CATALINA_HOME) or absolute path to the desired directory.

-->

<!--

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

directory="logs" prefix="localhost_access_log." suffix=".txt"

pattern="common" resolveHosts="false"/>

-->

<!-- Access log processes all requests for this virtual host. By

访问所有处理虚拟主机请求的Log.默认的

default, log files are created in the "logs" directory relative to

log文件在$CATALINA_HOME目录下的logs目录中被创建。

$CATALINA_HOME. If you wish, you can specify a different

如果你喜欢,你可以在directory属性中定义一个不同的目录

directory with the "directory" attribute. Specify either a relative

制定一个相对(相对与$CATALINA_HOME)或绝对的路进给需要的目录

(to $CATALINA_HOME) or absolute path to the desired directory.

This access log implementation is optimized for maximum performance,

这个可以访问的log实现是性能最优化,但是只对"common" 和

but is hardcoded to support only the "common" and "combined" patterns.

"combined" 模式是绝对支持的支持的

-->

<!--

<Valve className="org.apache.catalina.valves.FastCommonAccessLogValve"

directory="logs" prefix="localhost_access_log." suffix=".txt"

pattern="common" resolveHosts="false"/>

-->
</Host>

</Engine>

</Service>

</Server>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: