Tomcat多个实例同时 [英] Tomcat multiple instances simultaneously
问题描述
我正在尝试运行Tomcat的多个实例,但是即使在配置了用于侦听和关闭第二个实例的不同端口之后,它仍然尝试在8080(配置为8081)上进行侦听.我读到我必须为CATALINA_BASE
设置一个不同的值.在所有在线文章中,没有一个实际上显示可以在哪个文件中设置此变量.
在哪里以及如何在C:\apache-tomcat-7.0.39
运行Tomcat的两个副本的最简单方法涉及以下步骤(我试图运行两个不同版本的tomcat,分别为6和7):>
-
在不同的文件夹中创建2个tomcat副本(如果它们是不同的版本,那么这很容易,如果它们是相同的版本,则需要以其他方式进行区分.Tomcat中有很多文件创建要对其进行管理,因此不可能在相同的工作目录下运行两个实例)
-
更改
中tomcat正在侦听的以下端口server.xml
-
<Connector port="8080">
<-这是tomcat用于响应HTTP请求的端口 -
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
<-定义了两个端口,一个用于AJP连接器(如果您在Apache或IIS服务器后面使用tomcat时使用)和用于HTTPS流量的端口 -
<Server port="8005" shutdown="SHUTDOWN">
<-这是Tomcat用于响应SHUTDOWN事件的端口
-
最后,如果将其作为Windows服务运行,则需要为每个实例建立不同的服务名称(您可以在安装过程中执行此操作,Tomcat 7的默认值为tomcat7). Tomcat运行后,所有配置字段均使用相对路径,因此您无需触摸CATALINA_BASE
I am trying to run multiple instances of Tomcat, but even after configuring different ports for listening and shutting down the second instance, it keeps trying to listen on 8080 (configured for 8081). I read that I have to set a different value for CATALINA_BASE
. From all the articles there are online, none of them actually show in which file this variable can be set.
Where and how can I set CATALINA_BASE for my Tomcat instance in C:\apache-tomcat-7.0.39
The easiest way I have run two copies of Tomcat involved the following steps (I was trying to run two distinct versions of tomcat, 6 and 7):
Establish 2 copies of tomcat in different folders (if they are different versions then this is easy, if they are the same version then you will need be distinguished in some other way. There are a lot of files that Tomcat creates to manage it so running two instances with the same work directory likely isn't possible)
Change the following ports that tomcat is listening to in
server.xml
<Connector port="8080">
<- This is the port that tomcat uses to respond to HTTP requests<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
<- this defines two ports, one for the AJP connector (used if you are using tomcat behind an Apache or IIS server) and the port used for HTTPS traffic<Server port="8005" shutdown="SHUTDOWN">
<- this is the port that Tomcat uses to respond to SHUTDOWN events
Finally, if you are running this as a Windows service you will need to establish different service names for each instance (you can do this during setup, the default for Tomcat 7 is tomcat7). Once Tomcat is running all of it's configuration fields use relative paths so you don't need to touch CATALINA_BASE
这篇关于Tomcat多个实例同时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!