thecfguy

A Unique Developer

Running multiple tomcat instances with Coldfusion standard version

Since last month I was working with Railo and ColdFusion 9 (standard edition) to clustering and load balancing. I have started with Railo as I was new to Railo and keen to work around it. I wrote several post about Railo installation
Configure multiple sites on RAILO, Tomcat and Windows
Configure multiple sites on RAILO, Tomcat and Windows - part ii
Running multiple instances of RAILO on tomcat.

Now it turn of ColdFusion for load balancing. I have googled it about but mostly found articles with enterprise edition and it is easy to implement but I want to work with developer/standard edition. Below is step by step instruction to running multiple ColdFusion (standard edition) instances on one computer.
Requirement:

  1. Apache HTTP Server 2.2.17 (Download) (I work with .msi Installer)
  2. Tomcat 6 (Download) (I will preferred window zip version)
  3. War version of coldfusion.

We all knowing how to get war version but who are new to ColdFusion let me explain in few steps.

  1. Download ColdFusion developer edition (You may download other edition as well)
  2. Run setup and move next up to below screen. Just select option J2EE configuration and select option WAR file and finish installation.
  3. After finishing installation you will have folder with cfusion.war file.

Now we have enough material to run ColdFusion on tomcat. Extract tomcat zipped version in anywhere in harddrive ( In my case it was on e:\tomcat that I will refer as TOMCATHOME in post).

  1. Open you command prompt and change directory to TOMCATHOME/bin.
  2. Run startup.bat. You may need to setup JAVA_HOME (path to jdk) in environment variable.
  3. Browse http://localhost:8080/ to confirm Tomcat is running and configured correctly.
  4. To create tomcat service open command prompt (with administrative rights), change directory to TOMCATHOME/bin and type command service install tomcat6. You may need to create CATALINA_BASE environment variable with value TOMCATHOME.
  5. Now open server.xml file from TOMCATHOME/conf folder
  6. Add below code in Engine tag
    <Host name="cfsite.local"  appBase="e:\cfsite" unpackWARs="true" autoDeploy="true"> <Context path="" docBase="e:\cfsite\cfusion"/> </Host>

    e:\cfsite\cfusion where I will have my coldfusion site. (I will refer this path to CFSITE in post).
    NOTE: To run site with cfsite.local domain you need to register it in host file.
  7. Copy cfusion.war file into CFSITE folder and change default host in Engine tag in server.xml so it will read like..
    <Engine name="Catalina" defaultHost="cfsite.local" jvmRoute="worker1">
    For now keep jvmRoute=”worker1” later I will explain it.
  8. Restart your tomcat service. Once you restart your service cfusion folder created from .war under CFSITE.
  9. Browse http://cfsite.local:8080/CFIDE/administrator to confirm coldfusion is running and finish coldfusion installation. Now we have one coldfusion instance running.

    Now let’s create another instance of Tomcat to run same site.
  10. Create folder “instance1” under TOMCATHOME.
  11. Copy conf, log, temp, webapps folder from TOMCATHOME to TOMCATHOME/instance1.
  12. Open server.xml file from TOMCATHOME/instance1/conf and change port so it will not conflict with our main tomcat instance.

    <Server port="8005" shutdown="SHUTDOWN"> to <Server port="8015" shutdown="SHUTDOWN"><Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> to <Connector port="8081" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /><Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> to<Connector port="8019" protocol="AJP/1.3" redirectPort="8443" />
  13. To create service of second instance change directory to TOMCATHOME/bin. Copy tomcat6 to tomcat6instance. And set CATALINA_BASE variable to TOMCATHOME/instance1
    For ex. SET CATALINA_BASE=e:\Tomcat\instance1
    And type service install tomcatInstance. You will find another instance of tomcat is running.
  14. Browse http://cfsite.local:8081/CFIDE/administrator to confirm coldfusion is running.


My single coldfusion hosting site is running on two different instances. In Part - II we will work with load balancing with mod_jk and apache server.