Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tomcat Clustering

 
Ali John
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to add mod_jk libraries to tomcat ??
 
Rob Spoor
Sheriff
Pie
Posts: 20531
54
Chrome Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ali John
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20531
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is more than enough information on the mod_jk documentation page.
 
Ali John
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20531
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20531
54
Chrome Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i came here to find some solution to the problem.but its not getting done
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic