Hi,


I hv clustered 2 Tomcat (version 5.0.18) instances on 2 physically
different machines A and B.

Individually accessible as

            http://machineA:8080 <http://machinea:8080/>  and
http://machineB:8080 <http://machineb:8080/>



I have Apache 2.0.54 installed on machine A and following the tomcat doc


http://jakarta.apache.org/tomcat/tomcat-5.0-doc/balancer-howto.html



            I am trying to use Apache mod_rewrite to load balance/
failover between my 2 tomcat instances.



            As per the doc modified the <engine> element in server.xml
to include the jvmRoute attribute

            Configuring Apache was a headache.

The documentation assumes the reader is an expert with Apache.

It is not completely accurate. The reader cannot use it as is.

For instance it talks of creating balancer.conf but uses servers.conf in
http.



            Anyways I discovered it and created a balancing.conf for
mod_rewrite as explained.

           

            Edited apache's httpd.conf as given in the tomcat doc.

                        And with both tomcat instances working browsed
to


http://localhost/servlets-examples/servlet/RequestInfoExample

                        But it did not work. Error log gave:

File does not exist:
proxy:http://machineA:8080/servlets-examples/servlet/RequestInfoExample



               But I could get the expected page when I replaced [P, L]
in the RewriteRule for <Location /servlets-examples> with only [L]

           

            The funny thing however is I browse to


http://localhost/servlets-examples/servlet/RequestInfoExample

            but that later automatically changes to either


http://machineA:8080/servlets-examples/servlet/RequestInfoExample or


http://machineB:8080/servlets-examples/servlet/RequestInfoExample

            depending upon which Tomcat instance served my request.



Any clues as to why the URL in the browser changes?



PS: My entries in httpd.conf

               RewriteMap SERVERS rnd:<<path to the balancer.conf
created above>>
        <Location /servlets-examples>
            RewriteEngine On
            RewriteCond "%{HTTP_COOKIE}"
"(^|;\s*)jsessionid=\w*\.(\w+)($|;)"
            RewriteRule "(.*)"
"http://${SERVERS:%2}%{REQUEST_URI}";  [P,L]
            RewriteRule "^.*;jsessionid=\w*\.(\w+)($|;)"
"http://${SERVERS:$1}%{REQUEST_URI}";  [P,L]
            RewriteRule "(.*)"
"http://${SERVERS:ALL}%{REQUEST_URI}"; [P,L]
        </Location>



            << I had to replace [P,L] with [L] to make it work>>

           

rgds,

G1







This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information.
If you are not the intended recipient, please contact the sender by reply 
e-mail and destroy all copies of the original message.
Any unauthorised review, use, disclosure, dissemination, forwarding, printing 
or copying of this email or any action taken in reliance on this e-mail is 
strictly
prohibited and may be unlawful.

  Visit us at http://www.cognizant.com

Reply via email to