Linux下多tomcat部署
为了充分利用资源,可以在一台服务器下运行多个tomcat
step1:配置环境变量
export JAVA_HOME=/opt/jdk8 export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export PATH=$PATH:$JAVA_HOME/bin #tomcat8 export CATALINA_8_BASE=/opt/tomcat8 export CATALINA_8_HOME=/opt/tomcat8 export TOMCAT_8_HOME=/opt/tomcat8 #tomcat1 export CATALINA_1_BASE=/opt/tomcat1 export CATALINA_1_HOME=/opt/tomcat1 export TOMCAT_1_HOME=/opt/tomcat1 #tomcat2 export CATALINA_2_BASE=/opt/tomcat2 export CATALINA_2_HOME=/opt/tomcat2 export TOMCAT_2_HOME=/opt/tomcat2
使环境变量立即生效:
source /etc/profile
step2:修改各tomcat startup、shutdown获取环境变量
vim tomcat1/bin/startup.sh
vim tomcat1/bin/shutdown.sh
export CATALINA_HOME=$CATALINA_1_HOME export CATALINA_BASE=$CATALINA_1_BASE
其它以此类推
step3:修改服务端口
vim tomcat1/conf/server.xml
使Server port、Connector port http1.1、Connector port AJP端口与其它tomcat各不相同即可
如tomcat1:
<Server port="7005" shutdown="SHUTDOWN"> <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> <Connector port="7009" protocol="AJP/1.3" redirectPort="8443" />
tomcat2:
<Server port="9005" shutdown="SHUTDOWN">
<Connector port="9090" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
<Connector port="9009" protocol="AJP/1.3" redirectPort="8443" />
<Connector port="9090" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
<Connector port="9009" protocol="AJP/1.3" redirectPort="8443" />
step4:启动试试吧
相关推荐
farwang 2020-11-25
星愿心愿 2020-11-24
tianhuak 2020-11-24
zhjn0 2020-11-24
昭君出塞 2020-11-23
bluecarrot 2020-11-23
linuxwcj 2020-10-21
以梦为马不负韶华 2020-10-20
彼岸随笔 2020-10-20
yutou0 2020-10-17
applecarelte 2020-10-16
ourtimes 2020-10-16
waterhorse 2020-09-19
MRFENGG 2020-11-11
rainandtear 2020-10-30
kyssfanhui 2020-10-20
liuhangtiant 2020-10-20