tomcat to do multi-instance

tomcat to do multi-instance
decompression program to deploy tomcat
tar XF the Apache-tomcat-8.9.16.tar.gz
mv the Apache-tomcat-8.9.16 / usr / local /
create an instance of a
mkdir -p / usr / local / tomcat_instance / tomcat1
copy of the program conf files in the directory into the instance of the
cp -R /usr/local/apache-tomcat-8.9.16/conf/ / usr / local / tomcat_instance / tomcat1
create start and stop scripts in examples
mkdir / usr / local / tomcat_instance / tomcat1 / bin
Touch / usr / local / tomcat_instance / tomcat1 / bin
the chmod + X /usr/local/tomcat_instance/tomcat1/bin/startup.sh
LS / usr / local / tomcat_instance /
point to an instance directory path (editor)
Vim /usr/local/tomcat_instance/tomcat1/bin/startup.sh
------------------------------------ ------------------------
#! / bin / bash
export CATALINA_HOME="/usr/local/apache-tomcat-8.5.16"
export CATALINA_BASE="/usr/local/tomcat_instance/tomcat1"
export CATALINA_TMPDIR="$CATALINA_BASE/temp"
export CATALINA_PID="$CATALINA_BASE/bin/tomcat.pid"
export JAVA_OPTS="-server -Xms1024m -Xmx1024m -Djava.awt.headless=true -Dtomcat.name=tomcat1"
# Create a logs directory
IF [-d "$ CATALINA_BASE / logs"!]; The then
  mkdir $ CATALINA_BASE / logs
fi
# Create a temp directory
IF [-d "$ CATALINA_BASE / temp"!]; The then
  mkdir $ CATALINA_BASE / temp
fi
# Call tomcat startup script
bash $ CATALINA_HOME / bin / startup.sh "$ @"
-------------------------------- --------------------------------
second instance, supra
 touch / usr / local / tomcat_instance / tomcat2} / bin /shutdown.sh
chmod + the X-/usr/local/tomcat_instance/{tomcat1,tomcat2}/bin/shutdown.sh
 vim /usr/local/tomcat_instance/tomcat1/bin/shutdown.sh
---------- -------------------------------------------------- ---------
#! / bin / bash
Export CATALINA_HOME = "/ usr / local / the Apache-Tomcat-8.5.16"
Export CATALINA_BASE = "/ usr / local / tomcat_instance / tomcat1"
Export CATALINA_TMPDIR = "$ CATALINA_BASE / the TEMP "
Export CATALINA_PID =" $ CATALINA_BASE / bin / tomcat.pid "
bash $CATALINA_HOME/bin/shutdown.sh "$@"
------------------------------------------------------------------------------
[root@localhost ~]# vim /usr/local/tomcat_instance/tomcat2/bin/shutdown.sh
#!/bin/bash
export CATALINA_HOME="/usr/local/apache-tomcat-8.5.16"
export CATALINA_BASE="/usr/local/tomcat_instance/tomcat2"
export CATALINA_TMPDIR="$CATALINA_BASE/temp"
export CATALINA_PID="$CATALINA_BASE/bin/tomcat.pid"
$ CATALINA_HOME bash / bin / shutdown.sh "$ @"
------------------------------------- ---------------------------
create a test page
# mkdir -p / usr / local / tomcat_instance / {tomcat1, tomcat2} / webapps / ROOT
edit file
 Vim /usr/local/tomcat_instance/tomcat1/webapps/ROOT/index.jsp
<HTML>
<title>. 1-the Tomcat </ title>
<body>
    the Hello This IS-the Tomcat. 1.
</ body>
</ HTML>
start tomcat instance
 /usr/local/tomcat_instance/tomcat1/bin/startup.sh
view the listening port
netstat -lnpt | grep java
 
 
 

Guess you like

Origin www.cnblogs.com/123456likun/p/11566911.html