- February 8, 2017
- Posted by: user
- Category: Uncategorized
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.
[code:xml]LoadModule jk_module modules/mod_jk.so[/code]
Create file workers.properties under APACHE_HOME/conf and open it in text editor. Paste below code in it and save file.
Name worker1 and worker2 was defined in server.xml of tomcat’s configuration file (remember <Engine name=”Catalina” defaultHost=”railosite1.local” jvmRoute=”worker1″>) and port is setup for AJP/1.3 connector.
Save workers.properties file and open httpd.conf file again. Copy below code in httpd.conf file under last LoadModule statement we have inserted.
[code:xml]# Path to workers.properties
# Path to jk logs
# Jk log level [debug/error/info]
# Jk log format
JkLogStampFormat “[%a %b %d %H:%M:%S %Y] “
# JkOptions for forwarding
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat “%w %V %T”
JkMount / balancer
JkMount /* balancer[/code]
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.