Let's say that you have only one Tomcat folder located in C:\apache-tomcat-7.0.39, and that you wish to run two instances from it.
Make sure that you have CATALINA_HOME system/user variable set, and pointing to C:\apache-tomcat-7.0.39
- Create a folder C:\instance1. Copy conf, webapps and temp folders from C:\apache-tomcat-7.0.39 and paste them to C:\instance1. You can delete contents from webapps and temp folders located under instance1, but don't touch conf contents.
- Now copy>paste C:\instance1 and rename it to instance2. That way, both instance1 and instance2 will have the same content.
- Go to C:\instance2\conf, edit server.xml and change the numbers of these ports (I marked those as XXXX):
<Server port="XXXX" shutdown="SHUTDOWN">
<Connector port="XXXX" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
<Connector port="XXXX" protocol="AJP/1.3" redirectPort="8443" />
- Deploy whatever you want into instance1\webapps and instance2\webapps
- Create the following 4 batch files under C:\
instance1_startup.bat
@echo offset CATALINA_BASE=C:\instance1cd "%CATALINA_HOME%\bin"set TITLE=My Tomcat Instance 01call startup.bat %TITLE%
instance1_shutdown.bat
@echo offset CATALINA_BASE=C:\instance1cd "%CATALINA_HOME%\bin"call shutdown.bat
instance2_startup.bat
@echo offset CATALINA_BASE=C:\instance2cd "%CATALINA_HOME%\bin"set TITLE=My Tomcat Instance 02call startup.bat %TITLE%
instance2_shutdown.bat
@echo offset CATALINA_BASE=C:\instance2cd "%CATALINA_HOME%\bin"call shutdown.bat
- Run instance1_startup.bat and instance2_startup.bat, hopefully it should work.
No comments:
Post a Comment