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

supervisor+tomcat单机多实例

时间:2020-04-27 17:24:41      阅读:62      评论:0      收藏:0      [点我收藏+]

标签:catalina   vim   x64   txt   direct   code   port   lib   local   

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单机多实例

标签:catalina   vim   x64   txt   direct   code   port   lib   local   

原文地址:https://www.cnblogs.com/wanglinyan/p/12787711.html

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