You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Antonio Fiol Bonnín <fi...@terra.es> on 2004/02/04 20:31:19 UTC

mod_jk as a load balancer - Am I missing something obvious?

Hello,

I have tried to configure mod_jk as a load balancer WITH sticky sessions.

I get the load balancing to work perfectly, but NOT the sticky sessions.

This is what I tried:

I set up 4 "ajp13" workers and 2 "lb" workers.

Worker names are "t1_a", "t1_b", "t2_a" and "t2_b".
Load balancer names are "a" and "b", and they point to:
"a" --> "t1_a", "t2_a"
"b" --> "t1_b", "t2_b"

t1_a --> tomcat 1 port X
t1_b --> tomcat 1 port Y
t2_a --> tomcat 2 port X
t2_b --> tomcat 2 port Y

On Tomcat 1, jvmRoute is "t1".
On Tomcat 2, jvmRoute is "t2". (So, jvmRoutes are set-up).

Am I missing something very obvious?

Do jvmRoutes need to have the same name as the workers? I find that 
strange, but I can't come up with something more logical...

Thank you for any tip.

Yours,


Antonio Fiol


P.S.: I am using two connectors on each Tomcat because one is configured 
with scheme="http" secure="false", and the other is scheme="https" 
secure="true". Our app relies upon that.

Re: mod_jk as a load balancer - Am I missing something obvious?

Posted by Daniel <da...@yorku.ca>.
Hi,

You can try out these step-by-step instructions:

http://www.yorku.ca/dkha/tomcat/docs/apache-tomcat-modjk.htm

Regards,
Daniel

On Wed, 4 Feb 2004, [ISO-8859-1] Antonio Fiol Bonn�n wrote:

> Hello,
>
> I have tried to configure mod_jk as a load balancer WITH sticky sessions.
>
> I get the load balancing to work perfectly, but NOT the sticky sessions.
>
> This is what I tried:
>
> I set up 4 "ajp13" workers and 2 "lb" workers.
>
> Worker names are "t1_a", "t1_b", "t2_a" and "t2_b".
> Load balancer names are "a" and "b", and they point to:
> "a" --> "t1_a", "t2_a"
> "b" --> "t1_b", "t2_b"
>
> t1_a --> tomcat 1 port X
> t1_b --> tomcat 1 port Y
> t2_a --> tomcat 2 port X
> t2_b --> tomcat 2 port Y
>
> On Tomcat 1, jvmRoute is "t1".
> On Tomcat 2, jvmRoute is "t2". (So, jvmRoutes are set-up).
>
> Am I missing something very obvious?
>
> Do jvmRoutes need to have the same name as the workers? I find that
> strange, but I can't come up with something more logical...
>
> Thank you for any tip.
>
> Yours,
>
>
> Antonio Fiol
>
>
> P.S.: I am using two connectors on each Tomcat because one is configured
> with scheme="http" secure="false", and the other is scheme="https"
> secure="true". Our app relies upon that.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: mod_jk as a load balancer - Am I missing something obvious?

Posted by Antonio Fiol Bonnín <fi...@terra.es>.
Thank you, Dave.

>>Do jvmRoutes need to have the same name as the workers? 
>>    
>>
>Yes, they do.
>  
>

Then that means I cannot have two AJP connectors on each Tomcat.

Proposed setup is, then:
Worker names are "t1" and "t2"
Load balancer name is "t":
t --> t1, t2
t1 --> tomcat 1 port X (jvmRoute="t1")
t2 --> tomcat 2 port X (jvmRoute="t2")

On Apache I have:
<VirtualHost hostname:80>
...
JkMount /myapp/* t
#was "a"
</VirtualHost>
<VirtualHost hostname:443>
...
JkMount /myapp/* t
#was "b"
</VirtualHost>


Or, if we remove the hassle of load balancing, I can just "JkMount 
/myapp/* t1", which is what I initially had (several months ago). But 
then...

How do I get request.isSecure() and request.getScheme() working 
properly? I.e. How can I detect whether the user is coming in through 
HTTP or HTTPS? They ALWAYS return "false" and "http" respectively, 
regardless of what protocol the user used.

Previously, I did it by adding secure="true" scheme="https" to one 
connector on each Tomcat. Now I cannot, as I only have one connector!!

Thank you for any further guidance.

Antonio Fiol

Re: mod_jk as a load balancer - Am I missing something obvious?

Posted by David Rees <dr...@greenhydrant.com>.
On Wed, February 4, 2004 1at 1:31 am, Antonio Fiol Bonnín wrote:
> Am I missing something very obvious?
>
> Do jvmRoutes need to have the same name as the workers? I find that
> strange, but I can't come up with something more logical...

Yes, they do.

-Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org