Admin User Feb,08 2017
This one is actually part-ii of my first blog “Running multiple tomcat instances with Coldfusion standard version - Part I” but to make it more meaningful I have changed title of this Post.
In previous post we have run single site on two instance of tomcat and on different port. Now time to run both instance under single website URI with load balancing for high availability under Apache server.
Let's install Apache http server using downloaded .msi, to avoid security issue and spacing in path I prefer to install “C:\Apache2.2” [APACHE_HOME] and make sure it is pointing to port 80. Once finish with installing browse URL http://localhost to make sure Apache server is configured and running correctly. To perform load balancing on two tomcat instance download mod_jk. Use Binary releases link and choose your appropriate platform and download file mod_jk-1.2.31-httpd-2.2.3.so. Copy it to APACHE_HOME/modules folder and rename it to mod_jk.so.
Open httpd.conf file from APACHE_HOME/conf folder and copy below text after last LoadModule statement.
LoadModule jk_module modules/mod_jk.so
Create file workers.properties under APACHE_HOME/conf and open it in text editor. Paste below code in it and save file.
Save workers.properties file and open httpd.conf file again. Copy below code in httpd.conf file under last LoadModule statement we have inserted.
# Path to workers.propertiesJkWorkersFile c:/apache2.2/conf/workers.properties# Path to jk logsJkLogFile c:/apache2.2/mod_jk.log# Jk log level [debug/error/info]JkLogLevel info# Jk log formatJkLogStampFormat "[%a %b %d %H:%M:%S %Y] "# JkOptions for forwardingJkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories# JkRequestLogFormat set the request formatJkRequestLogFormat "%w %V %T"JkMount / balancerJkMount /* balancer
Save your file and restart apache server. Now you should able to browse http://cfsite.local (No port number needed anymore).
Now stop first tomcat instance service and keep second instance running and vice versa. You will find in both cases our site is running as Apache will transfer request to running instance. If you are managing login in session variable then you may need to relogin because we are not performing session sharing.
I didn’t get much success in sharing session between two instance of ColdFusion, will post it if I get success in this.
Hope you guys find this helpful.