Sometimes we want to run multiple instance of Apache TOMCAT on same machine may be for load balancing, separating web application etc. This article describes on how we can run multiple instance of Apache TOMCAT on same machine.
Running multiple Apache TOMCAT instance does not require any change in the server code, we just need to change the port no assigned to the Apache TOMCAT.
NOTE:
- In this article i will be referring to Apache TOMCAT 6 configuration. But the same is applicable for 5.5 also.
- Also to change the port configuration you need to edit server.xml, this file resides insideapache-tomcat-/conf/ folder.
Ports Used in Apache TOMCAT:
- Shutdown Port
- Tomcat Connector Port
- AJP Connector Port
- Redirect Port
This port is used when we try to shutdown the Apache TOMCAT Server. We can identify this Port inside server.xml by checking the following tag.
Connector Port:
This port is used to connect to Apache TOMCAT server. By default 8080 is set. We can identify this Port inside server.xml by checking the following tag.
AJP Connector Port:
This port is used AJP port, AJP is used to redirect the request to Apache Web Server from Apache TOMCAT Server. We can identify this Port inside server.xml by checking the following tag.
Redirect Port:
Any redirection happening inside Apache TOMCAT will happen through this port. In Apache TOMCAT there are two instance where redirectPort is mentioned. First one is for the Apache TOMCAT server and other one is for the AJP port. We can identify this Port inside server.xml by checking the following tag.
You need to only change the port no only, rest is taken care by the tomcat server. Ensure that redirectPort should be same for AJP and HTTP protocol.