单机多实例部署tomcat
1: /usr/local/tomcat
2: /usr/local/tomcat2
step1:/etc/profile
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
JAVA_HOME=/usr/java/jdk1.7.0_67
JAVA_BIN=/usr/java/jdk1.7.0_67/bin
PATH=$PATH:$JAVA_BIN
CLASSPATH=$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export JAVA_HOME JAVA_BIN PATH CLASSPATH
CATALINA_BASE=/usr/local/tomcat
CATALINA_HOME=/usr/local/tomcat
TOMCAT_HOME=/usr/local/tomcat
export CATALINA_BASE CATALINA_HOME TOMCAT_HOME
CATALINA_BASE2=/usr/local/tomcat2
CATALINA_HOME2=/usr/local/tomcat2
TOMCAT_HOME2=/usr/local/tomcat2
export CATALINA_BASE2 CATALINA_HOME2 TOMCAT_HOME2
step2:修改startup.sh 和 shutdown.sh (只需要修改第二个实例就行了,第一个用默认值)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
在第一个实例中,/usr/local/tomcat/bin/startup.sh和shutdown.sh 最后部分中exec之前添加如下:
export JAVA_HOME=$JAVA_HOME
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=$JAVA_HOME/lib
export CATALINA_HOME=$CATALINA_HOME2
export CATALINA_BASE=$CATALINA_BASE2
step3:将$TOMCAT_HOME2/conf/server.xml 中所有port修改为新值
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8005--->8006--->8007
8080--->8081----8082
8443--->8444---->8445
8009--->8010---->8011
来源:oschina
链接:https://my.oschina.net/u/3293292/blog/1358269