Apache Load Balancer on Top of Tomcat 6 - Missing Something and it's Not Working -


i'm trying basic apache 2.2 load balancer running on top of 2 tomcat 6 installations. i'm reading through documentation , i'm having trouble getting working correctly. i'm have apache configuration correct, think i'm missing in tomcat settings that's preventing connection. tomcat connector documentation how modify apache, doesn't mention needs change in tomcat settings.

here's basic set up. 3 installs on same machine (this test setup). so, apache 2.2 installed in c:\apache directory. listens on port 80. 2 tomcat 6 installs, 1 listens on port 81, 1 on port 82. apache route tomcat servers, acting 100% load balancer.

here's errors i'm getting in mod_jk.log file when try connection @ http://localhost:80/index.jsp . it's 502 bad gateway error.

[mon nov 15 13:05:04.681 2010] [3596:1496] [error] ajp_connection_tcp_get_message::jk_ajp_common.c (1245): wrong message format 0x4854 127.0.0.1:81 [mon nov 15 13:05:04.681 2010] [3596:1496] [error] ajp_get_reply::jk_ajp_common.c (2058): (tomcat1) tomcat down or refused connection. no response has been sent client (yet) [mon nov 15 13:05:04.681 2010] [3596:1496] [info] ajp_service::jk_ajp_common.c (2543): (tomcat1) sending request tomcat failed (recoverable), because of protocol error (attempt=1) 

here settings have in apache's httpd.conf file...

loadmodule jk_module modules/mod_jk.so <ifmodule jk_module>     jkworkersfile conf/workers.properties     jklogfile logs/mod_jk.log     jkloglevel info     jkmountfile conf/uriworkermap.properties </ifmodule> 

here workers.properties file have...

# # file provides minimal jk configuration properties needed # connect tomcat. # # workers jk should create , work # worker.list=loadbalancer,jkstatus  # # define servers in our cluster # worker.tomcat1.type=ajp13 worker.tomcat1.host=localhost worker.tomcat1.port=81 worker.tomcat1.lbfactor=2  worker.tomcat2.type=ajp13 worker.tomcat2.host=localhost worker.tomcat2.port=82 worker.tomcat2.lbfactor=1  # # defining load balancer # worker.loadbalancer.type=lb worker.loadbalancer.balance_workers=tomcat1,tomcat2 worker.loadbalancer.sticky_session=false  # # define status worker # worker.jkstatus.type=status 

here uriworkermap.properties have

# # file provides sample mappings example wlb # worker defined in workermap.properties.minimal # general syntax file is: # [url]=[worker name]  /*.*=loadbalancer 

finally, here's tomcat's engine tag in server.xml file

<engine name="catalina" defaulthost="localhost" jvmroute="tomcat1">        <realm classname="org.apache.catalina.realm.userdatabaserealm" resourcename="userdatabase" />        <host name="localhost" appbase="webapps" deployonstartup="true">         <valve classname="org.apache.catalina.valves.accesslogvalve"                  directory="logs"  prefix="localhost_access_log." suffix=".txt"                  pattern="common" resolvehosts="false"/>       </host>      </engine> 

found correct answer after additional digging. needed create ajp connector in each tomcat's server.xml file. apache's mod_jk connects port, , tomcat relays port http connector port.

<connector port="8009" protocol="ajp/1.3" redirectport="81" /> 

Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -