`
isolated
  • 浏览: 50898 次
  • 性别: Icon_minigender_2
  • 来自: 北京
社区版块
存档分类
最新评论

实现在tomcat中跑多个服务器实例

阅读更多

Server.xml 注释
  Server:

  Server只能有一个,它代表整个JVM,server可以包含一个或者多个service

  Service:

  service包含一个或者多个connector和container。

  Conector:

  connector用来为container接收请求,和返回响应的。

  Engine:

  engine是顶层container,它可以包含一个或者多个host

  Host:

  host是虚拟主机,它可以包含一个或者多个context

  Context:

  context对应一个web application。

  最近抽时间研究了一下tomcat的源码,发现可以增加多个Service到server.xml中,实现在tomcat中跑多个服务器实例,在Server.xml中增加如下配置信息:

  Xml代码

  <Service name="Catalina2">

  <Connector port="8081"

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

  enableLookups="false" redirectPort="8443" acceptCount="100"

  debug="0" connectionTimeout="20000"

  disableUploadTimeout="true" />

  <Connector port="8010"

  enableLookups="false" redirectPort="8443" debug="0"

  protocol="AJP/1.3" />

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

  <Logger className="org.apache.catalina.logger.FileLogger"

  prefix="catalina2_log." suffix=".txt"

  timestamp="true"/>

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

  debug="0" resourceName="UserDatabase"/>

  <Host name="localhost" debug="0" appBase="webapps2"

  unpackWARs="true" autoDeploy="true"

  xmlValidation="false" xmlNamespaceAware="false">

  <Logger className="org.apache.catalina.logger.FileLogger"

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

  timestamp="true"/>

  </Host>

  </Engine>


 


TAG标签: 服务器 tomcat


本文转自 ☆★ 包罗万象网 ★☆ - http://www.baoluowanxiang.com 转载请注明出处,侵权必究!
原文链接:http://www.baoluowanxiang.com/a/program/java/2010/0705/1138.html

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics