wood burning stoves*
The moose likes Tomcat and the fly likes Tomcat Clustering Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat Clustering" Watch "Tomcat Clustering" New topic
Author

Tomcat Clustering

Ali John
Greenhorn

Joined: May 10, 2012
Posts: 11
hi ,i am trying to do tomcat cl;ustering,but mod_jk and some issues are not getting resolved..can anyone help me ?
Ali John
Greenhorn

Joined: May 10, 2012
Posts: 11
how to add mod_jk libraries to tomcat ??
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19543
    
  16

You don't add mod_jk to Tomcat, you add it to Apache HTTPD. It then talks to Tomcat's AJP connector, by default on port 8009.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Ali John
Greenhorn

Joined: May 10, 2012
Posts: 11
Can you please tell me the simple steps for doing the same.
i am new to linux,so finding lot of problem in configurations..
Thanks !!
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19543
    
  16

There is more than enough information on the mod_jk documentation page.
Ali John
Greenhorn

Joined: May 10, 2012
Posts: 11
i hav followed all the steps and configured my Tomcat ..
can you tell me how to make a test application to check whether clustering is working or not?
till now my set up is on a single machine,i.e vertical clustering ....can you please suggest ???
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19543
    
  16

All you need is a simple servlet that prints the server's host name. ServletRequest's getLocalName() method may work, but they may also show the load balancer's address / name. You would need to test that. If that's the case, use InetAddress.getLocalHost() instead.

After you've created this web app with servlet, you need to deploy it on all balanced servers and make sure the load balancer has a forwarding rule for it. Then just try it out. Use multiple client machines and multiple browsers. You should see the different host names show up.
Ali John
Greenhorn

Joined: May 10, 2012
Posts: 11
http://my.safaribooksonline.com/book/-/9781849516624/9dot-clustering-in-tomcat-7/id286784234
i have followed all the steps from this book for virtual clustering..

but when it comes to configuring apppache and tomcat together,i am having problems.Can you please hav a look at page no 228 of that book and tell me if its right or wrong?
i am not able to know what to fill in these options

LoadModulejk_module modules/mod_jk.so
JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel info
JkMount /sample/* loadbalancer
JkMount /* loadbalancer
....
Thanks, and i have changed the name too.
Ali John
Greenhorn

Joined: May 10, 2012
Posts: 11
if i share my server.xml files for both the tomcat instances and apache httpd.conf ,workers.properties file with you,i feel you will be able to find out the problem.


i have created a nrmal jsp and kept it under a folder under webapps of both the tomcats.
then i shutdown one of the tomcats and tried to acces that jsp,it didnot work...that means clustering is not working.


Thanks.....
Ali John
Greenhorn

Joined: May 10, 2012
Posts: 11
my mod_jk is itself not working....as i am not able to visit contexts from port 80.
my mod_jk.conf file is http://fpaste.org/k0EZ/
my workers.properties file is http://fpaste.org/wQgH/

..please tell me what problem is there in these files?i built mod_jk by downloading tar.gz,untarred it to apache_home/native/modules/ and inside it i used build-unix.sh
Thanks.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19543
    
  16

Put the space between LoadModule and jk_module. Make sure all the file paths are correct. I especially don't like the value of "workers.tomcat_home" - that should be the path where Tomcat is installed.

Although it is possible to load balance two Tomcat servers on the same host, it's harder to distinguish the difference between them. Both will have the same host name.
Ali John
Greenhorn

Joined: May 10, 2012
Posts: 11
here is my tomcatnode1's server.xml http://fpaste.org/6TMB/
and my tomcatnode2's server.xml is http://fpaste.org/kCwr/
my apache's httpd.conf file is http://fpaste.org/pQHE/
modified mod_jk.so file is http://fpaste.org/0E7L/
and workers.properties file is http://fpaste.org/ZGTV/


any peroblems you can find in them ? because setup is still not working.

Thanks.
Ali John
Greenhorn

Joined: May 10, 2012
Posts: 11
i came here to find some solution to the problem.but its not getting done
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Tomcat Clustering
 
Similar Threads
How to deploy a web application ?
Apache tomcat and Jakarta tomcat
Tech Word Game
Form Based secruity...
WA #1.....word association