Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

am a little confused when setting up 2 tomcat6 instances cluster in a clean ubuntu server 12.04. i didn't install default tomcat6 i used tomcat6-user's tomcat6-instance-create to create 2 instances. I'm using blogs.encodo.ch tutorial, unfortunately i haven't come across any tutorial using ubuntu with how apache2 is configured like ubuntu 12.o4. i mean by that , the structure of sites-available/enabled folder and mods-available/enabled that ubuntu uses.
i've installed libapache2-mod-jk and mods-enabled has jk.load,jk.conf.

server instance-1 uses port 8081 for http, port 8009 for ajp with jvmRoute="worker1" and instance-2 uses port 8082 for http, port 8010 for ajp with jvmRoute="worker2"

#/etc/apache2/workers.propeties
 worker.list=loadbalancer,jk-status

#setup instance-1
worker.instance-1.port=8009
worker.instance-1.host=localhost
worker.instance-1.type=ajp13
#worker.instance-1.lbfactor=50

#setup instance-2
worker.instance-2.port=8010
worker.instance-2.host=localhost
worker.instance-2.type=ajp13
#worker.instance-2.lbfactor=100

#setup the load-balancer
worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=instance-1,instance-2
worker.loadbalancer.sticky_session=True
#worker.loadbalancer.sticky_session_force=True

# Status worker for managing load balancer
worker.status.type=jk-status

here is the /etc/apache2/mods-available/jk.conf

<IfModule jk_module>
    JkWorkersFile /etc/apache2/workers.properties

    JkLogFile /var/log/apache2/mod_jk.log

    JkLogLevel info

    JkShmFile /var/log/apache2/jk-runtime-status

    JkWatchdogInterval 60

    <Location /jk-status>
    # Inside Location we can omit the URL in JkMount
    JkMount jk-status
    Order deny,allow
    Deny from all
    Allow from 127.0.0.1 xxx.xxx.xxx.xxx
    </Location>
    <Location /jk-manager>
    # Inside Location we can omit the URL in JkMount
    JkMount jk-manager
    Order deny,allow
    Deny from all
    Allow from 127.0.0.1 xxx.xxx.xxx.xxx
    </Location>

    # Example for Mounting a context to the worker "balancer"
    # The URL syntax "a|b" instantiates two mounts at once,
    # the first one is "a", the second one is "ab".
    # JkMount /myapp|/* balancer

    # Example for UnMounting requests for all workers
    # using a simple URL pattern
    # Since: 1.2.26
    # JkUnMount /myapp/static/* *

    # Example for UnMounting requests for a named worker
    # JkUnMount /myapp/images/* balancer

    # Example for UnMounting requests using regexps
    # SetEnvIf REQUEST_URI "\.(htm|html|css|gif|jpg|js)$" no-jk

    # Example for setting a reply timeout depending on the requets URL
    # Since: 1.2.27
    # SetEnvIf Request_URI "/transactions/" JK_REPLY_TIMEOUT=600000

    # Example for disabling reply timeouts for certain request URLs
    # Since: 1.2.27
    # SetEnvIf Request_URI "/reports/" JK_REPLY_TIMEOUT=0
</IfModule>

here is my virtualhost

<VirtualHost *:80>
  ServerAdmin support@myserver.com
  ServerAlias live.myserver.com
  #DocumentRoot /var/www
  ServerName go2.myserver.com
  JkMount /* loadbalancer
  JkMount /status/* jk-status
  JkMount /jk-manager/* jk-status
  #Loglevel warn
  ErrorLog /var/log/apache2/go.myserver_error_log
  CustomLog /var/log/apache2/go.myserver_access_log combined
</VirtualHost>

EDIT: after few hours of struggling the load balancing itself seems to work. just that i can't access the load balancer manager page via xxx.xxx.xxx.xxx/jk-status nor xxx.xxx.xxx.xxx/jk-manager. there are also this entries in the mod_jk.log file

[Mon May 06 13:34:48.633 2013] [9845:139723554592576] [info] init_jk::mod_jk.c (3252): mod_jk/1.2.32 () initialized
[Mon May 06 13:34:48.633 2013] [9845:139723554592576] [error] uri_worker_map_ext::jk_uri_worker_map.c (506): Could not find worker with name 'jk-manager' in uri map post processing.
[Mon May 06 13:34:48.633 2013] [9845:139723554592576] [error] uri_worker_map_ext::jk_uri_worker_map.c (506): Could not find worker with name 'jk-status' in uri map p/var/log/apache2/mod_jk.log

Question 1 : what am i missing? why it doesn't work?

Question 2 : is the #DocumentRoot /var/www really necessary?

Question 3 : what is the difference between the JkMount in the IfModule of the jk.conf file and the JkMount from the virtualhost

Kindly help me set this up correctly. thanks

share|improve this question
    
Well, re: Question 2, Things following a # in Apache configuration files are comments (i.e. as far as Apache is concerned they don't exist). So no, anything following a # is not necessary unless it contributes in some way to your understanding of the contents of the file. –  voretaq7 May 6 '13 at 17:49
    
@voretaq7 i commented it out myself because as far as am concerned it's useless in my case. if you check the link of the tutorial i was following DocumentRoot was uncommented. THanks –  black sensei May 6 '13 at 17:54
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.