标签: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
标签:index ESS local 启动脚本 部署 http chmod pid 多实例
原文地址:https://www.cnblogs.com/zc1741845455/p/10921277.html