A short guide of tomcat 6.x clustering.
Tomcat is a widely used Web Server, many J2EE applications using tomcat. In this article, we will discuss about tomcat 6.x clustering step by step.
In a large application (application that has many users), application performance will be an issue. To reduce server load in one machine, cluster is a solution.
Let us begin the tomcat cluster and load balancer steps :
1. Download tomcat 6.x, then unzip it to your destination folder. After unzip it, copy to three copies. (e.g : apache-tomcat- 6.0.29, apache-tomcat-6.0.29 – B, apache-tomcat-6.0.29 – C). see screenshot for detail :
2.Open first tomcat, go to “conf → server.xml” open with editor.
- Change “AJP 1.3 Connector Port” from 8009 to 8109.<Connector port="8109" protocol="AJP/1.3" redirectPort="8443" />
- Change “jvmRoute” to “tomcatA”<Engine name="Catalina" defaultHost="localhost" jvmRoute="tomcatA">
Do the same thing to tomcat B and C.
Tomcat B : AJP Connector Port = 8209 and jvmRoute= tomcatB
Tomcat C : AJP Connector Port = 8309 and jvmRoute= tomcatC
3. Download apache http server and mod_jk. Unzip it to your destination folder. Put mod_jk.so to apache http server → modules, and mod_jk.conf to http server/conf.
4. Open httpd.conf (Apache http server → conf → httpd.conf). Add “LoadModule jk_module modules/mod_jk.so” at the LoadModule section.
5. Create workers.properties file at Apache http server/conf (same place with httpd.conf). Put this content below to workers.properties.
6. Add this configuration statement to read workers.properties to httpd.conf.
7. Try to start http server. Open your browser go to : http://localhost. If the browser say : “It Works!”. It mean your http server work fine.
8. Now, deploy your application to webapps in every tomcat server. Before deployment, don't f orget to add your application url link to httpd.conf file. (In my example, my application context root/ link is “HRMS”).
9. After running all the tomcat server, my url link will be : http://localhost/HRMS . See your tomcat running console which tomcat server your application actived.
10. Check the failover by killing the server where the application active. Then see if your application still alive or not. It should be active to another server. Try to monitor your tomcat running console.
Thanks for readers, may this article can help you to cluster your tomcat servers.
Tidak ada komentar:
Posting Komentar