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_BASE is 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.
从这段描述可以看出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管理端口用不同的端口号)
先转载了,不懂得以后慢慢看