twitter
    !! Tell us what you want to Learn / Know !!

Clustering

A cluster is a group of Tomcat server instances, working in coordination.

   Clustering provides:
  • High Availability
  • Load Balancing and
  • Scalability
Creating a cluster

  Step1: 
            Create two instances Instance1 and Instance2.
How to create an Instance?
           Just copy the Tomcat directory and rename it to your choice.
  
Step2:
            Change the ports of Instance2 as shown below.
            Open the server.xml file located in $CATALINA_HOME/conf
            Modify the server.xml as shown below.


Original lines
Modified Lines
<Server port="8005" shutdown="SHUTDOWN">
<Server port="9005" shutdown="SHUTDOWN">
<Connector port="8080" protocol="HTTP/1.1"
<Connector port="9090" protocol="HTTP/1.1"
<Connector port="8009" protocol="AJP/1.3"
<Connector port="9009" protocol="AJP/1.3"

Step3:
      Now find the following Line and uncomment it in both the server.xml files, I mean in Instance1 and    Instance2.

<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>

Step4:
            Start Instance1; wait for the instance to start and start second instance (Instance2).
The screens look like below



Step5:
          Now deploy this (download) application into webapps folder of Instance1.

         Now let us access the application using Instance2 port.

         http://localhost:9090/suren

      

0 comments:

Post a Comment