tomcat多实例感觉在实际使用中意义不大,不过可以模拟多台TOMCAT服务器的场景,减轻实验机器压力,多应用更靠谱 LINK:tomcat多应用(虚拟主机)配置
jdk版本:jrockit-jdk1.6.0_37-R28.2.5-4.1.0
tomcat版本:apache-tomcat-7.0.39
jrockit安装位置 /usr/local/jrockit/
tomcat安装位置 /usr/local/apache-tomcat-7.0.39/
需要包apr-1.4.6.tar.gz、apr-util-1.5.1.tar.gz、jrockit-jdk1.6.0_37-R28.2.5-4.1.0-linux-ia32.bin(32位)、apache-tomcat-7.0.39.tar.gz
tar zxvf apr-1.4.6.tar.gz cd apr-1.4.6./configuremake && make install |
tar zxvf apr-util-1.5.1.tar.gzcd apr-util-1.5.1./configure --with-apr=/usr/local/aprmake && make install |
./jrockit-jdk1.6.0_37-R28.2.5-4.1.0-linux-ia32.bin#安装第二步选择安装目录/usr/local/jrockit/ln -s -f /usr/local/jrockit/jre/bin/java /usr/bin/ln -s -f /usr/local/jrockit/bin/javac /usr/bin/ |
环境配置 – vim /etc/profile
#set JAVA & TOMCAT ENVIRONMENTexport JAVA_HOME=/usr/local/jrockitexport CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/libexport PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/binexport CATALINA_HOME=/usr/local/apache-tomcat-7.0.39export JAVA_HOME CLASSPATH PATH CATALINA_HOMEexport LD_LIBRARY_PATH=/usr/local/apr/lib |
source /etc/profile #刷新环境变量 |
java version "1.6.0_37"Java(TM) SE Runtime Environment (build 1.6.0_37-b06)Oracle JRockit(R) (build R28.2.5-20-152429-1.6.0_37-20120927-1915-linux-ia32, compiled mode)/*JAVA配置成功*/ |
LINK:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
每个实例供用TOMCAT的/bin、/lib内的包,单独使用其他文件
实例都存放在tomcat的安装文件目录中,名称叫webapps1,webapps2
cd /usr/local/apache-tomcat-7.0.39/mkdir {webapps1,webapps2}cp -r {conf/,logs/,temp/,webapps/,work/} webapps1cp -r {conf/,logs/,temp/,webapps/,work/} webapps2 |
修改/usr/local/apache-tomcat-7.0.39/conf/server.xml
对应webapps1/conf/server.xml、webapps2/conf/server.xml,修改端口、名称、应用位置等
分别启动对应实例
export CATALINA_BASE=$CATALINA_HOME/bin/bash $CATALINA_HOME/bin/startup.sh -Dcatalina.baseexport CATALINA_BASE=$CATALINA_HOME/webapps1/bin/bash $CATALINA_HOME/bin/startup.sh -Dcatalina.baseexport CATALINA_BASE=$CATALINA_HOME/webapps2/bin/bash $CATALINA_HOME/bin/startup.sh -Dcatalina.base