Find the answer to your Linux question:
Results 1 to 7 of 7
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. ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jan 2007
    Posts
    71

    loadbalancer with mod_jk on ubuntu 12.04: status page won't show


    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 ..:: Loadbalancing with mod_jk and Apache > Tips and Tricks > Encodo Blogs ::.. 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"
    Code:
        #/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

    Code:
      
        <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
    Code:
        <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
    Code:
        [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
    Last edited by atreyu; 05-07-2013 at 03:38 AM. Reason: swapped confusing PHP tags for regular CODE tags

  2. #2
    Linux Newbie nplusplus's Avatar
    Join Date
    Apr 2010
    Location
    Charlotte, NC, USA
    Posts
    106
    Okay, it's been awhile since I have worked with this stuff, so I am working on vague memory and what you have here, but I noticed a couple of things.

    In /etc/apache2/mods-available/jk.conf, you should likely comment out the jk-status location tag section, and under <Location /jk-manager>, change "JkMount jk-manager" to "JkMount jk-status." Give that a try and let me know if it makes a difference.

    N

  3. #3
    Just Joined!
    Join Date
    Jan 2007
    Posts
    71
    Hello nplusplus,

    i've tried your suggestion and still no luck, i did comment the location tags for jk-status , and modified the the jkmoud to jk-status and even restarted apache2 it's still 404 not found

  4. #4
    Linux Newbie nplusplus's Avatar
    Join Date
    Apr 2010
    Location
    Charlotte, NC, USA
    Posts
    106
    Highjo!

    Have you taken a look at the official documentation? You might start here if not. The Apache Tomcat Connector - Reference Guide - Status Worker Reference

    N

  5. #5
    Just Joined!
    Join Date
    Jan 2007
    Posts
    71
    Hi, i've read the tutorial, and i made some progress. the mod_jk.log now doesn't complain about any error anymore
    PHP Code:
    [Tue May 07 17:38:01.654 2013] [32235:140522979305280] [infoinit_jk::mod_jk.(3252): mod_jk/1.2.32 () initialized
    [Tue May 07 17:38:01.657 2013] [32236:140522979305280] [infoinit_jk::mod_jk.(3252): mod_jk/1.2.32 () initialized
    [Tue May 07 17:54:57.208 2013] [37657:139941972453184] [infoinit_jk::mod_jk.(3252): mod_jk/1.2.32 () initialized
    [Tue May 07 17:54:57.212 2013] [37658:139941972453184] [infoinit_jk::mod_jk.(3252): mod_jk/1.2.32 () initialized
    [Tue May 07 17:56:35.609 2013] [38305:140655054878528] [infoinit_jk::mod_jk.(3252): mod_jk/1.2.32 () initialized
    [Tue May 07 17:56:35.612 2013] [38306:140655054878528] [infoinit_jk::mod_jk.(3252): mod_jk/1.2.32 () initialized 
    after i changed
    PHP Code:
    //changed
      
    worker.status.type=jk-status
    //to
      
    worker.jk-status.type=status 
    but that's all , still getting 404 Not Found

    I aslo commented :
    PHP Code:
    //from /etc/apache2/mods-available/jk.conf
            #<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-status
                #Order deny,allow
                #Deny from all
                #Allow from 127.0.0.1 xxx.xxx.xxx.xxx
            #</Location> 
    then added :
    PHP Code:
    // /etc/apache2/workers.properties
    worker.jk-status.mount=/admin/status 
    when i accessed myip/admin/status after apache restart it shows not found. I then commented out the JkMount from the virtual host to have this:
    PHP Code:
        <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
          JkMount /admin/status
          #Loglevel warn
          ErrorLog /var/log/apache2/go.myserver_error_log
          CustomLog /var/log/apache2/go.myserver_access_log combined
        </VirtualHost> 
    still no improvement. i feel like am getting crazy progressively
    Last edited by Highjo; 05-07-2013 at 06:05 PM.

  6. #6
    Linux Newbie nplusplus's Avatar
    Join Date
    Apr 2010
    Location
    Charlotte, NC, USA
    Posts
    106
    In your original post, you mentioned not having a guide for this on Ubuntu re: sites-available/enabled and mods-available/enabled and I totally disregarded it, but you should make sure you have symlinks in sites-enabled to any site configs you want enabled that you have modified in sites-available. The same goes for mods-available/enabled. Have a look here for how to enable sites and mods in Apache: https://help.ubuntu.com/10.04/serverguide/httpd.html.

    If the mods/sites you are configuring do not have the mentioned symlinks in sites/mods-enabled, they will not be served up by apache.

    N

  7. #7
    Just Joined!
    Join Date
    Jan 2007
    Posts
    71
    Hi, i think in most ubuntu distros i use , once mods are enabled using
    PHP Code:
    a2enmod 
    it creates the symlink to the conf in mods-available. same for sites-available. Because if not the load balancer itself would have not worked.
    PHP Code:
    // /etc/apache2/mods-enabled
    0 lrwxrwxrwx 1 root root 25 May  5 20:08 jk.conf -> ../mods-available/jk.conf
    0 lrwxrwxrwx 1 root root 25 May  5 20
    :08 jk.load -> ../mods-available/jk.load 
    PHP Code:
    0 lrwxrwxrwx 1 root root 36 May  6 11:34 go.myserver.com -> ../sites-available/go.myserver.com 
    As you can see, all the available conf/load are symlinked

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •