As part of the installation, Tomcat Service will be installed as a Linux service. The name of the Linux service will be in format tomcat.
Note: before you start, it's advised to set up a system snapshot. It will allow to restore the system if required.
Steps to duplicate Tomcat instance on the same server:
Stop quilliup service by running next command in terminal:
service tomcat stopDelete all the log files:
rm /opt/tomcat/logs/*Delete "Catalina" folder from "../tomcat/work" folder:
rm /opt/tomcat/work/*
1. Duplicate existing Tomcat instance:
Copy existing instance (usually "../opt/tomcat") and create new instance under same location. Assign new name (for example: "tomcat_prod")
cp -R opt/tomcat/* opt/tomcat_prod
2. Set ports for new Tomcat instance:
Tomcat uses defined HTTP(s) port numbers to authenticate with the application web server. Therefore, it's necessary to define new port numbers for the new instances.
Edit "../opt/tomcat_prod/conf/server.xml" file:
cd /opt/tomcat_prod/conf/Edit server.xml file:
sudo vi server.xmlChange the shutdown port, for example, from 8005 to 8006:
|
<Server port="8006" shutdown="SHUTDOWN"> <Listener className="org.apache.catalina.startup.VersionLoggerListener" /> |
Change the Connector port, for example, from 8080 to 7070:
|
<Connector port="7070" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="7070" /> <!-- A "Connector" using the shared thread pool--> |
Change the AJP port, for example, from 8009 to 8008:
|
<!-- Define an AJP 1.3 Connector on port 8009 --> <Connector port="8008" protocol="AJP/1.3" redirectPort="8080" /> |
3. Define the new Tomcat instance properties:
Open "../opt/tomcat_prod/webapps/ROOT/WEB-INF/classes/config.properties" file and change port, for example, from 8080 to 7070:
/opt/tomcat_prod/webapps/ROOT/WEB-INF/classes/Edit config.properties file:
sudo vi config.properties
|
... server.ip=ip server.port=7070 server.protocol=http ... |
4. Define the new Tomcat instance repository DB details:
DB connection details are set in “../opt/tomcat_prod/webapps/ROOT/WEB-INF/classes/connection.properties" file:
/opt/tomcat_prod/webapps/ROOT/WEB-INF/classes/Edit connection.properties file:
sudo vi config.propertiesUncomment your DB repository details (remove '#' sign from the beginning of each needed row).
Comment all irrelevant repositories (add '#' sign to the beginning of each needed row). Set correct repository DB details. For example: in case of MySQL uncommented rows will look like:
|
... connection.type=mysql connection.jdbcUrl=jdbc:mysql://ip:port/dbname?autoReconnect=true&useSSL=false connection.user=* connection.password=*
connection.showSql=false connection.generateDdl=true connection.idleConnectionTestPeriod=1000 connection.maxStatements=500 connection.default_schema=true connection.checkoutTimeout=3000 connection.maxIdleTime=1800 connection.testConnectionOnCheckin=false connection.acquireIncrement=2 connection.maxPoolSize=10 connection.minPoolSize=4 connection.testConnectionOnCheckout=true ... |
5. Start tomcat Instances:
service tomcat startStart tomcat_prod instance:
service tomcat_prod start
NOTE:
Working in HTTPS mode is optional.
The application is installed by default in HTTP mode with port 8080, it can be switched to HTTPS mode and port 8443 or port 443.
For detailed information please refer next manual: 4.1.3.0 Set-up an HTTPS instance.
Comments
0 comments
Please sign in to leave a comment.