码迷,mamicode.com
首页 > 其他好文 > 详细

tomcat多实例的部署

时间:2019-05-25 09:31:33      阅读:121      评论:0      收藏:0      [点我收藏+]

标签:index   ESS   local   启动脚本   部署   http   chmod   pid   多实例   

解压部署tomcat程序
创建2个实例的工作目录
mkdir -p /usr/local/tomcat8_instance/tomcat1
mkdir -p /usr/local/tomcat8_instance/tomcat2

拷贝tomcat 程序目录下的conf分别放入2个实例目录中
cp -R /usr/local/tomcat8/conf /usr/local/tomcat8_instance/tomcat1
cp -R /usr/local/tomcat8/conf/ /usr/local/tomcat8_instance/tomcat2
mkdir /usr/local/tomcat_instance8/{tomcat1,tomcat2}/bin
touch /usr/local/tomcat_instance8/{tomcat1,tomcat2}/bin/statup.sh
chmod +x /usr/local/tomcat_instance8/{tomcat1,tomcat2}/bin/startup.sh

在tomcat实例目录下的bin目录中创建实例启动和停止脚本
vim /usr/local/tomcat8_instance/tomcat1/bin/startup.sh
#!/bin/bash
export CATALINA_HOME="/usr/local/tomcat8"
export CATALINA_BASE="/usr/local/tomcat8_instance/tomcat1"
export CATALINA_TMPDIR="$CATALINX_BASE/temp"
export CATALINA_PID="$CATALINA_BASE/bin/tomcat.pid"
export JAVA_OPTS="-server -Xms1024m -Xmx1024m -Djava.awt.headless=true -Dtomcat.name=tomcat1"
#创建logs目录
if [ ! -d "$CATALINA_BASE/logs" ]
then
        mkdir $CATALINA_BASE/logs
fi

#创建temp目录
if [ ! -d "$CATALINA_BASE/temp" ]
then
        mkdir $CATALINA_BASE/temp
fi
#调用tomcat启动脚本
bash $CATALINA_HOME/bin/startup.sh "$@"


vim /usr/local/tomcat8_instance/tomcat2/bin/startup.sh
#!/bin/bash
export CATALINA_HOME="/usr/local/tomcat8"
export CATALINA_BASE="/usr/local/tomcat8_instance/tomcat2"
export CATALINA_TMPDIR="$CATALINX_BASE/temp"
export CATALINA_PID="$CATALINA_BASE/bin/tomcat.pid"
export JAVA_OPTS="-server -Xms1024m -Xmx1024m -Djava.awt.headless=true -Dtomcat.name=tomcat2"
#创建logs目录
if [ ! -d "$CATALINA_BASE/logs" ]
then
        mkdir $CATALINA_BASE/logs
fi

#创建temp目录
if [ ! -d "$CATALINA_BASE/temp" ]
then
        mkdir $CATALINA_BASE/temp
fi
#调用tomcat启动脚本
bash $CATALINA_HOME/bin/startup.sh "$@"


[root@localhost ~]# touch /usr/local/tomcat8_instance/{tomcat1,tomcat2}/bin/shutdown.sh
[root@localhost ~]# chmod +x /usr/local/tomcat8_instance/{tomcat1,tomcat2}/bin/shutdown.sh
[root@localhost ~]# vim /usr/local/tomcat8_instance/tomcat1/bin/shutdown.sh
#!/bin/bash
export CATALINA_HOME="/usr/local/tomcat8"
export CATALINA_BASE="/usr/local/tomcat8_instance/tomcat1"
export CATALINA_TMPDIR="$CATALINX_BASE/temp"
export CATALINA_PID="$CATALINA_BASE/bin/tomcat.pid"

bash $CATALINA_HOME/bin/shutdown.sh "$@"


[root@localhost ~]# vim /usr/local/tomcat8_instance/tomcat2/bin/shutdown.sh
#!/bin/bash
export CATALINA_HOME="/usr/local/tomcat8"
export CATALINA_BASE="/usr/local/tomcat8_instance/tomcat1"
export CATALINA_TMPDIR="$CATALINX_BASE/temp"
export CATALINA_PID="$CATALINA_BASE/bin/tomcat.pid"

bash $CATALINA_HOME/bin/shutdown.sh "$@"

修改实例中配置文件端口,详细文档中的
创建测试页

vim /usr/local/tomcat8_instance/tomcat1/webapps/ROOT/index.jsp

<html>
<title>Tomcat-1</title>
<body>
        THIS IS TOMCAT1
</body>
</html>
vim /usr/local/tomcat8_instance/tomcat2/webapps/ROOT/index.jsp
<html>
<title>This-TOMCAT2</title>
<body>
        this is tomcat2
</body>
</html>
访问http://192.168.30.21:8080
192.168.30.21:8090

tomcat多实例的部署

标签:index   ESS   local   启动脚本   部署   http   chmod   pid   多实例   

原文地址:https://www.cnblogs.com/zc1741845455/p/10921277.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!