-----
1. Install your first instance of Apache Tomcat
Just download an Apache Tomcat Windows Service Installer package from here. Just follow the steps to install. And I would expect the software to be install at this directory "C:\Program Files\Apache Software Foundation\Tomcat 6.0".
2. Duplicate Tomcat directory
Once you completed the step on above, here we are going to duplicate two more Tomcat instance.
As mentioned before, your first instance installed in "C:\Program Files\Apache Software Foundation\Tomcat 6.0"; to get the second instance of Tomcat, just copy whole Tomcat directory from "C:\Program Files\Apache Software Foundation\Tomcat 6.0" into "C:\Program Files\Apache Software Foundation\Tomcat 6.0.2". For the third instance of Tomcat, just copy whole Tomcat directory from "C:\Program Files\Apache Software Foundation\Tomcat 6.0" into "C:\Program Files\Apache Software Foundation\Tomcat 6.0.3".
As mentioned before, your first instance installed in "C:\Program Files\Apache Software Foundation\Tomcat 6.0"; to get the second instance of Tomcat, just copy whole Tomcat directory from "C:\Program Files\Apache Software Foundation\Tomcat 6.0" into "C:\Program Files\Apache Software Foundation\Tomcat 6.0.2". For the third instance of Tomcat, just copy whole Tomcat directory from "C:\Program Files\Apache Software Foundation\Tomcat 6.0" into "C:\Program Files\Apache Software Foundation\Tomcat 6.0.3".
Once you donce that, you would have something like this.
3. Configurate the Apache Tomcat instances
By default, Apache Tomcat configured serval ports, for example Connector Port, Shutdown Port, AJP(Apache JServ Protocol) Connection Port & Redirect Port, to run the service. In order to get multiple Tomcat run on a single machine, we need to configurate the following ports on each instance.
Here are the ports we are going to use for the Apache Tomcat instances:
Apache Tomcat 1 (First Install one)
Connector Port: 8080 (Default)
Shutdown Port: 8005 (Default)
AJP Port: 8009 (Default)
Redirect Port: 8100 (Default)
Apache Tomcat 2
Connector Port: 8081
Shutdown Port: 8006
AJP Port: 8010
Redirect Port: 8101
Apache Tomcat 3
Connector Port: 8082
Shutdown Port: 8007
AJP Port: 8011
Redirect Port: 8102
Connector Port: 8080 (Default)
Shutdown Port: 8005 (Default)
AJP Port: 8009 (Default)
Redirect Port: 8100 (Default)
Apache Tomcat 2
Connector Port: 8081
Shutdown Port: 8006
AJP Port: 8010
Redirect Port: 8101
Apache Tomcat 3
Connector Port: 8082
Shutdown Port: 8007
AJP Port: 8011
Redirect Port: 8102
Now we can go to the server.xml from /conf directory of your Tomcat folder. Change the following ports in the server.xml file.
CONNECTOR PORT
This is the port where Apache Tomcat listen to HTTP request.
<connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
Change it according to the Tomcat instance planned on above.
SHUTDOWN PORT
This is the port used to shutdown the Apache Tomcat. We have the change the port number by identify the tag as following in server.xml.
<server port="8005" shutdown="SHUTDOWN">
AJP (APACHE JSERV PROTOCOL) CONNECTOR PORT
The Apache JServ Protocol (AJP) is a protocol that conduct inbound requests from a web server to an application server that sits behind the web server. We can identify this Port inside server.xml by checking the following tag.
<connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
REDIRECT PORT
Any redirection happening inside Apache Tomcat will happen through this port. In the server.xml, there are two places mentioned the redirectPort. We have the change both places as well.
<connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
<connector port="8100" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
<connector port="8100" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
Once, you completed the configuration on above, the different instance of Apache Tomcat should run on different port.
4. Install Windows Services
To startup an Tomcat instance, we need to create a Windows Services which kick start the instance by supplying corresponding parameters. Open a DOS prompt, and netvigate to Tomcat's bin directory. To install a service, type Tomcat6.exe //IS//<service_name>, where <service_name> is the name of the service you want to create.
Here, we are going to create two extra instance, the steps would be like this:
To create the Windows Service instance for the Tomcat located in C:\Program Files\Apache Software Foundation\Tomcat 6.0.2\bin. Here are the commands.
To create the Windows Service instance for the Tomcat located in C:\Program Files\Apache Software Foundation\Tomcat 6.0.2\bin. Here are the commands.
cd C:\Program Files\Apache Software Foundation\Tomcat 6.0.2\bin
Tomcat6.exe //IS//Tomcat602
Tomcat6.exe //IS//Tomcat602
To create another Windows Service instance for the Tomcat located in C:\Program Files\Apache Software Foundation\Tomcat 6.0.3\bin. Here are the commands.
cd C:\Program Files\Apache Software Foundation\Tomcat 6.0.3\bin
Tomcat6.exe //IS//Tomcat603
Tomcat6.exe //IS//Tomcat603
Once you completed the above, youe should see there are two extra services in your list of Windows Services.
5. Edit Windows Services
Here we are going to configurate the newly created services. And we are going to execute a command to call the corresponding Windows Service. And the command is like this Tomcat6w.exe //ES//<service_name>.
To edit the Tomcat instance located in C:\Program Files\Apache Software Foundation\Tomcat 6.0.2\bin, we need to make sure that the command prompt located in C:\Program Files\Apache Software Foundation\Tomcat 6.0.2\bin.
cd C:\Program Files\Apache Software Foundation\Tomcat 6.0.2\bin
Tomcat6w.exe //ES//Tomcat602
Tomcat6w.exe //ES//Tomcat602
To edit the Tomcat instance located in C:\Program Files\Apache Software Foundation\Tomcat 6.0.3\bin, we need to make sure that the command prompt located in C:\Program Files\Apache Software Foundation\Tomcat 6.0.3\bin.
cd C:\Program Files\Apache Software Foundation\Tomcat 6.0.3\bin
Tomcat6w.exe //ES//Tomcat603
Tomcat6w.exe //ES//Tomcat603
And you will see a window popup with 6 tabs, now you need to follow the following pictures to do the settings.
No comments:
Post a Comment