Chapter 17: Clustering Setting Up Multiple Tomcat Instances on One Machine To enable multiple instances of Tomcat 6 to run on the same physical machine, each instance must have at least the following: . Its own configuration directory . Its own tempdirectory . Its own webappsdirectory . Its own temporary workdirectory . Its own logsdirectory . TCP ports (for the AJP Connector) that do not conflict with other instances . Optionally, other private TCP or JDBC resources, depending on the backend session-sharing mechanism being deployed Three batch files, called start1.bat, start2.bat, and start3.bat, are created and placed into the /bindirectory. These batch files set the CATALINA_BASE environment variable and then call the startup.batTomcat startup script. Tomcat 6 checks for the existence of the CATALINA_BASE environment variable and uses it to locate the base directory for startup. Each of the start1.bat, start2.bat, and start3.batfiles sets the CATALINA_BASE variable to a different directory, allowing for variation in configuration. For example, start1.batcontains the following: set CATALINA_BASE=c:clustermachine1 call startup On Linux systems with a Bourne shell, it contains the following: export CATALINA_BASE=/cluster/machine1 sh startup.sh This tells Tomcat 6 to look for configuration information and Web application in the c:cluster machine1 directory. Figure 17-8 shows the directory hierarchy used here in subsequent cluster testing. Note in Figure 17-8 that each machine1, machine2, and machine3 directory houses the configuration files for the respective Tomcat 6 instances to be started. Shutting Down the Tomcat Cluster Similar to the startn.bat files, three stopn.batfiles exist for shutting down the individual server instances. These batch files set the CATALINA_BASE environment variable and then call the shutdown script for the server. For example, following is the content of stop3.bat: set CATALINA_BASE=c:clustermachine3 call shutdown Configuring Minimal Web Applications Only the examples application (the servlet and JSP examples from Tomcat distribution) is loaded for each of the three machine instances. In general, when setting up a cluster, you should try to minimize the
If you looking for unlimited one inclusive web hosting plan please check cheap web hosting website.
This entry was posted
on Thursday, November 12th, 2009 at 4:29 am and is filed under tomcat.
You can follow any responses to this entry through the RSS 2.0 feed.
Responses are currently closed, but you can trackback from your own site.