Apache & Tomcat Load balancing via Mod_jk issue

15,416

WORKERS.PROPERTIES

# Load-balancing behaviour 
worker.loadbalancer.type=lb 
worker.loadbalancer.balance_workers=worker1,worker2 

#JkMount /* loadbalancer 
JkMount /examples/jsp lb 
JkMount /examples/jsp/* lb

This is wrong. Move the JkMount directive to the mod_jk.conf, something like this:

JkWorkersFile conf/jk/workers.properties 
JkShmFile logs/mod_jk.shm 
JkLogFile logs/mod_jk.log 
JkLogLevel info 
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] " 

JkMount /examples/jsp loadbalancer
JkMount /examples/jsp/* loadbalancer

Notice that the Tomcat worker should be loadbalancer as you defined in the workers.properties, instead of lb.

Share:
15,416
vikingz
Author by

vikingz

Updated on September 18, 2022

Comments

  • vikingz
    vikingz over 1 year

    I hope this finds you all in the best of your health and spirits. I have an issue with a new setup where I currently have 1 APACHE 2.2.15 & Tomcat 6.0.14 on RHEL. Mod_JK version 1.2.30. Ill add the second Tomcat when this starts working.

    So when I try to point my browser to apache-host: port i get IT WORKS , but if point browser to host: port //examples/jsp/ i get a 404....apache isnt forwarding requests to Tomcat Tomcat works fine , i can browse to the JSP examples page and run stuff. I just cannot do it through the apache. Any help is very much appreciated...please help!!!!!

    Here are my configs.... no virtual hosts configured...

    HTTPD.CONF 
    Include conf/jk/mod_jk.conf 
    LoadModule jk_module modules/mod_jk.so 
    
    MOD_JK.CONF 
    JkWorkersFile conf/jk/workers.properties 
    JkShmFile logs/mod_jk.shm 
    JkLogFile logs/mod_jk.log 
    JkLogLevel info 
    JkLogStampFormat "[%a %b %d %H:%M:%S %Y] " 
    
    WORKERS.PROPERTIES 
    worker.list=loadbalancer,status 
    
    # Node #1 properties 
    worker.worker1.type=ajp13 
    worker.worker1.host=localhost 
    worker.worker1.port=8009 
    worker.worker1.lbfactor=1 
    
    # Node #2 properties(will be configured later when apache and node 1 start working) 
    worker.worker2.type=ajp13 
    worker.worker2.host=localhost 
    worker.worker2.port=001 
    worker.worker2.lbfactor=1 
    
    # Load-balancing behaviour 
    worker.loadbalancer.type=lb 
    worker.loadbalancer.balance_workers=worker1,worker2 
    
    # Status worker for managing load balancer 
    worker.status.type=status 
    
    #JkMount /* loadbalancer 
    JkMount /examples/jsp lb 
    JkMount /examples/jsp/* lb 
    
    
    tomcat server.xml has this 
    <Service name="Catalina"> 
    ... 
    <!-- Define an AJP 1.3 Connector on port 8009 --> 
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> 
    ... 
    </Service>
    
    • LiuYan 刘研
      LiuYan 刘研 about 11 years
      where did you put JkMount config? workers.properties? it should be putted in Apache config file (or a file under /etc/httpd/conf.d directory).
  • vikingz
    vikingz about 11 years
    Got it working...
  • vikingz
    vikingz about 11 years
    OK got it working.....after those 2 changes , i found out tomcat ajp port's configuration has an issue...i had this....<Service name="Catalina"> <!-- Define an AJP 1.3 Connector on port 8009 --> <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> </Service> .............................i removed <Service name="Catalina"> and removed /service....and only used <!-- Define an AJP 1.3 Connector on port 8009 --> <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />...tomcat worked fine...no errors.....apache work fine no errors....thank you Quanta & Liu Yuan!!!!