Running multiple tomcat instances with Coldfusion standard version - Part I
Since couple of weeks 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
Installing RAILO Tomcat on windows step by step
Installing RAILO Tomcat on windows step by step - 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.
- Apache HTTP Server 2.2.17 (Download) (I work with .msi Installer)
- Tomcat 6 (Download) (I will preferred window zip version)
- War version of coldfusion.
We all knowing how to get war version but who are new to ColdFusion let me explain in few steps.
- Download ColdFusion developer edition (You may download other edition as well)
- Run setup and move next up to below screen. Just select option J2EE configuration and select option WAR file and finish installation.
- 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).
- Open you command prompt and change directory to TOMCATHOME/bin.
- Run startup.bat. You may need to setup JAVA_HOME (path to jdk) in environment variable.
- Browse http://localhost:8080/ to confirm Tomcat is running and configured correctly.
- 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.
- Now open server.xml file from TOMCATHOME/conf folder
- 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.
- 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.
- Restart your tomcat service. Once you restart your service cfusion folder created from .war under CFSITE.
- 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.
- Create folder “instance1” under TOMCATHOME.
- Copy conf, log, temp, webapps folder from TOMCATHOME to TOMCATHOME/instance1.
- 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" />
- 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.
- Browse http://cfsite.local:8081/CFIDE/administrator to confirm coldfusion is running.
Hurray… My single coldfusion site is running on two different instances. In Part - II we will work with load balancing with mod_jk and apache server.