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

Tomcat - CATALINA_BASE与CATALINA_HOME的区别

2014-05-07 11:02 429 查看
引用Tomcat User Guide的一段话:
Throughout the docs, you'll notice there are numerous references to $CATALINA_HOME.
This represents the root of your Tomcat installation. When we say, "This information can be found in your $CATALINA_HOME/README.txt file" we mean to look at the README.txt file at the root of your Tomcat install. Optionally, Tomcat may be configured for multiple
instances by defining$CATALINA_BASE for
each instance. If multiple instances are not configured, $CATALINA_BASEis
the same as $CATALINA_HOME.

These are some of the key tomcat directories:
/bin - Startup, shutdown, and other scripts. The 
*.sh
 files (for Unix systems) are functional duplicates of the 
*.bat
 files (for Windows
systems). Since the Win32 command-line lacks certain functionality, there are some additional files in here.
/conf - Configuration files and related DTDs. The most important file in here is server.xml. It is the main configuration file for the container.
/logs - Log files are here by default.
/webapps - This is where your webapps go.
The description below uses the variable name $CATALINA_HOME to refer to the directory into which you have installed Tomcat
5, and is the base directory against which most relative paths are resolved. However, if you have configured Tomcat 5 for multiple instances by setting a CATALINA_BASE directory, you should use $CATALINA_BASE instead of $CATALINA_HOME for each of these references.

从这段描述可以看出CATALINA_HOME和CATALINA_BASE的区别。简单的说,CATALINA_HOME是Tomcat的安装目录,CATALINA_BASE是Tomcat的工作目录。如果我们想要运行Tomcat的 多个实例,但是不想安装多个Tomcat软件副本。那么我们可以配置多个工作目录,每个运行实例独占一个工作目录,但是共享同一个安装目录。

Tomcat每个运行实例需要使用自己的conf、logs、temp、webapps、work和shared目录,因此CATALINA_BASE就指向这些目录。 而其他目录主要包括了Tomcat的二进制文件和脚本,CATALINA_HOME就指向这些目录。如果我们希望再运行另一个Tomcat实例,那么我们可以建立一个目录,把conf、logs、temp、webapps、work和shared拷贝到该目录下,然后让CATALINA_BASE指向该目录即可。

在一台服务器上,可以运行多个tomcat实例,不需要安装多个tomcat,可以采用不同的用户,以test用户为例,拷贝/usr/local/apache-tomcat- 6.0.18目录到/home/test下,删除/home/test/apache-tomcat-6.0.18/bin子目录(此目录不需要),编辑 /home/test/.bash_profile文件,设置CATALINA_HOME指向刚才的安装目录/usr/local/apache- tomcat-6.0.18,设置JAVA_HOME指向刚才的安装目录/usr/java/jdk1.6.0_11。设置CATALINA_BASE指
向/home/test/apache-tomcat-6.0.18,设置CATALINA_OPTS跟/root/.bash_profile的一致 (jmx管理端口用不同的端口号)

先转载了,不懂得以后慢慢看
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  java tomcat