BestYunYan[云燕]

_______________________________生命不息,折腾不止。

   :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

1.下载安装jdk

wget 地址https://down.oracle.com  
tar -xvzf jdk-8u131-linux-x64.tar.gz -C /opt/;mv /opt/jdk* /opt/jdk

2.下载安装Tomcat

wget 地址https://mirror.bit.edu.cn   

tar -xvzf apache-tomcat-7.0.78.tar.gz -C /opt/;mv /opt/apache* /opt/tomcat8080
cp -a /opt/tomcat8080 /opt/tomcat8081
cp -a /opt/tomcat8080 /opt/tomcat8082
cp -a /opt/tomcat8080 /opt/tomcat8083
cp -a /opt/tomcat8080 /opt/tomcat8084


3.修改tomcat配置文件server.xml[修改监听端口]

sed -i 's/8080/8081/g;s/8005/8105/g;s/8009/8109/g;s/8443/8441/g' /opt/tomcat8081/conf/server.xml
sed -i 's/8080/8082/g;s/8005/8205/g;s/8009/8209/g;s/8443/8442/g' /opt/tomcat8082/conf/server.xml
sed -i 's/8080/8083/g;s/8005/8305/g;s/8009/8309/g;s/8443/8440/g' /opt/tomcat8083/conf/server.xml
sed -i 's/8080/8084/g;s/8005/8405/g;s/8009/8409/g;s/8443/8444/g' /opt/tomcat8084/conf/server.xml

4.配置启动文件:

sed -i '107a export JAVA_HOME=/opt/jdk' /opt/tomcat8080/bin/catalina.sh
sed -i '108a export PATH=${JAVA_HOME}/bin:$PATH' /opt/tomcat8080/bin/catalina.sh
sed -i '107a export JAVA_HOME=/opt/jdk' /opt/tomcat8081/bin/catalina.sh
sed -i '108a export PATH=${JAVA_HOME}/bin:$PATH' /opt/tomcat8081/bin/catalina.sh
sed -i '107a export JAVA_HOME=/opt/jdk' /opt/tomcat8082/bin/catalina.sh
sed -i '108a export PATH=${JAVA_HOME}/bin:$PATH' /opt/tomcat8082/bin/catalina.sh
sed -i '107a export JAVA_HOME=/opt/jdk' /opt/tomcat8083/bin/catalina.sh
sed -i '108a export PATH=${JAVA_HOME}/bin:$PATH' /opt/tomcat8083/bin/catalina.sh
sed -i '107a export JAVA_HOME=/opt/jdk' /opt/tomcat8080/bin/catalina.sh
sed -i '108a export PATH=${JAVA_HOME}/bin:$PATH' /opt/tomcat8080/bin/catalina.sh


5.多实例启动

for i in `seq 8080 8083`;do /opt/tomcat${i}/bin/shutdown.sh ;done
for i in `seq 8080 8083`;do /opt/tomcat${i}/bin/startup.sh ;done
for i in `seq 8080 8083` ;do curl 192.168.0.214:${i} -I ;done

6.多实例curl检查

ss -lntp|grep 8
for i in `seq 8080 8089` ;do curl 192.168.0.215:${i} -I ;done
for i in `seq 8080 8089` ;do curl 192.168.0.215:${i} -I|head -1;done |wc -l

参考博文:http://www.cnblogs.com/milton/p/4505670.html

posted on 2018-05-30 18:02  BestYunYan[云燕]  阅读(251)  评论(0编辑  收藏  举报