supervisor+tomcat单机多实例

Posted wanglinyan

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了supervisor+tomcat单机多实例相关的知识,希望对你有一定的参考价值。

yum安装supervisor

yum -y install supervisor

设置开机自启

systemctl enable supervisord

安装jdk

tar -zxvf jdk-8u60-linux-x64.tar.gz -C /usr/local/
chown -R root.root /usr/local/jdk1.8.0_60

追加多行到一个文件

1、echo
2、cat

echo用法:

echo "111" >> test.txt

cat用法:

cat >>test.txt<<EOF
333
444
EOF

配置jdk环境变量

cat>>/etc/profile<<EOF
###jdk环境###
export JAVA_HOME=/usr/local/jdk1.8.0_60
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
export CLASSPATH=.$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar
EOF

使环境变量生效

source /etc/profile

查看java版本

java -version

安装tomcat

1 tar -zxvf apache-tomcat-8.5.45.tar.gz
2 mkdir -p /opt/app01
3 cp -a apache-tomcat-8.5.45/* /opt/app01/
4 cd /opt/
5 cp app01/ app02

配置supervisor文件

vim /etc/supervisord.d/app01.ini
[program:app01]
command=/opt/app01/bin/catalina.sh run
environment=JAVA_HOME="/usr/local/jdk1.8.0_60",JAVA_BIN="/usr/local/jdk1.8.0_60/bin"
directory=/opt/app01/bin/
numprocs=1
user = root
autostart = true
autorestart=true
startsecs = 5
vim /etc/supervisord.d/app02.ini
[program:app02]
command=/opt/app02/bin/catalina.sh run
environment=JAVA_HOME="/usr/local/jdk1.8.0_60",JAVA_BIN="/usr/local/jdk1.8.0_60/bin"
directory=/opt/app02/bin/
numprocs=1
user = root
autostart = true
autorestart=true
startsecs = 5

启动supervisor

systemctl restart supervisord

技术图片

技术图片

以上是关于supervisor+tomcat单机多实例的主要内容,如果未能解决你的问题,请参考以下文章

tomcat单机多实例

Tomcat 的单机多实例配置

Tomcat单机多实例配置

Tomcat单机多实例配置

tomcat 单机多实例

tomcat 单机多实例