mod_jk failover and preferring localhost

View: New views
14 Messages — Rating Filter:   Alert me  

mod_jk failover and preferring localhost

by thuss2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

We have 10 web servers with Tomcat's running on them and a mod_jk configuration to prefer the tomcat on localhost and only failover to another machine if the local one fails. This worked fine under our older mod_jk, however, we just upgraded to 1.2.15 and now it that the local_worker properties are no longer supported, it's load balancing every request.

So I checked out the workers.properties options page: http://tomcat.apache.org/connectors-doc/config/workers.html and noticed the new distance option so that I can give localhost a distance of 0 and everything else a greater distance so that the load balancer should always prefer localhost. However, it seems to be ignoring the distance property completely and load balancing every request. Can anyone suggest what I might try to get it to always use the local tomcat for requests unless it fails:

worker.list=tomcat
worker.tomcat.type=lb
worker.tomcat.socket_timeout=195
worker.tomcat.balance_workers=localhost,latin1,latin2,...
worker.tomcat.sticky_session=False

worker.localhost.port=8009
worker.localhost.host=localhost
worker.localhost.type=ajp13
worker.localhost.lbfactor=1
worker.localhost.distance=0

worker.latin1.port=8009
worker.latin1.host=latin1
worker.latin1.type=ajp13
worker.latin1.lbfactor=1
worker.latin1.distance=1

worker.latin2.port=8009
worker.latin2.host=latin2
worker.latin2.type=ajp13
worker.latin2.lbfactor=1
worker.latin2.distance=1

Thanks,
Todd

Re: mod_jk failover and preferring localhost

by Filip Hanik - Dev Lists :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

you've setup sticky_sessions to be false, (btw, I thought that only took
0/1 values) so how can you expect session affinity from that?

Filip


thuss2 wrote:

> We have 10 web servers with Tomcat's running on them and a mod_jk
> configuration to prefer the tomcat on localhost and only failover to another
> machine if the local one fails. This worked fine under our older mod_jk,
> however, we just upgraded to 1.2.15 and now it that the local_worker
> properties are no longer supported, it's load balancing every request.
>
> So I checked out the workers.properties options page:
> http://tomcat.apache.org/connectors-doc/config/workers.html and noticed the
> new distance option so that I can give localhost a distance of 0 and
> everything else a greater distance so that the load balancer should always
> prefer localhost. However, it seems to be ignoring the distance property
> completely and load balancing every request. Can anyone suggest what I might
> try to get it to always use the local tomcat for requests unless it fails:
>
> worker.list=tomcat
> worker.tomcat.type=lb
> worker.tomcat.socket_timeout=195
> worker.tomcat.balance_workers=localhost,latin1,latin2,...
> worker.tomcat.sticky_session=False
>
> worker.localhost.port=8009
> worker.localhost.host=localhost
> worker.localhost.type=ajp13
> worker.localhost.lbfactor=1
> worker.localhost.distance=0
>
> worker.latin1.port=8009
> worker.latin1.host=latin1
> worker.latin1.type=ajp13
> worker.latin1.lbfactor=1
> worker.latin1.distance=1
>
> worker.latin2.port=8009
> worker.latin2.host=latin2
> worker.latin2.type=ajp13
> worker.latin2.lbfactor=1
> worker.latin2.distance=1
>
> Thanks,
> Todd
>
> --
> View this message in context: http://www.nabble.com/mod_jk-failover-and-preferring-localhost-t1825380.html#a4979143
> Sent from the Tomcat - User forum at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@...
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
>
>  


--


Filip Hanik

---------------------------------------------------------------------
To start a new topic, e-mail: users@...
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: mod_jk failover and preferring localhost

by thuss2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Filip, we're not using sessions so we don't need sessions affinity, but if we did we'd use session replication rather than sticky sessions. The sticky option does accept true/false according to the documentation http://tomcat.apache.org/connectors-doc/config/workers.html . I think that's all unrelated to the issue we're seeing though which is that mod_jk seems to be completely ignoring the distance parameter.

-Todd

Re: mod_jk failover and preferring localhost

by Mladen Turk-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Filip Hanik - Dev Lists wrote:
> you've setup sticky_sessions to be false, (btw, I thought that only took
> 0/1 values) so how can you expect session affinity from that?
>

Recent mod_jk versions can take True/False instead 1/0 just
as an convenience method.

Also the 'distance' param will be supported with
the next 1.2.16 release.


Regards,
Mladen.

---------------------------------------------------------------------
To start a new topic, e-mail: users@...
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: mod_jk failover and preferring localhost

by thuss2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

That explains it, thanks. I've just set the lbfactor extremely high on the localhost in the interim to get mod_jk to prefer it over remote tomcats.

-Todd

Re: mod_jk failover and preferring localhost

by Filip Hanik - Dev Lists :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Mladen Turk wrote:
> Filip Hanik - Dev Lists wrote:
>> you've setup sticky_sessions to be false, (btw, I thought that only
>> took 0/1 values) so how can you expect session affinity from that?
>>
>
> Recent mod_jk versions can take True/False instead 1/0 just
> as an convenience method.
instead or "as well", the latter right?

Filip
>
>


--


Filip Hanik

---------------------------------------------------------------------
To start a new topic, e-mail: users@...
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Parent Message unknown RE: mod_jk failover and preferring localhost

by Per Johnsson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi!
Is 1.2.16 avaiable for download somewhere?

Found this:
http://tomcat.apache.org/connectors-doc/news/20060505.html

Regards Per

-----Original Message-----
From: Mladen Turk [mailto:mladen.turk@...]
Sent: den 21 juni 2006 21:14
To: Tomcat Users List
Subject: Re: mod_jk failover and preferring localhost

Filip Hanik - Dev Lists wrote:
> you've setup sticky_sessions to be false, (btw, I thought that only
> took
> 0/1 values) so how can you expect session affinity from that?
>

Recent mod_jk versions can take True/False instead 1/0 just as an
convenience method.

Also the 'distance' param will be supported with the next 1.2.16
release.


Regards,
Mladen.

---------------------------------------------------------------------
To start a new topic, e-mail: users@... To unsubscribe,
e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


********************************************************************************
This e-mail and the information it contains may be privileged and/or
confidential.  It is for the intended addressee(s) only.
The unauthorised use, disclosure or copying of this e-mail, or any information it contains, is prohibited.
If you are not an intended recipient, please contact the sender and delete the material from your computer.
********************************************************************************



---------------------------------------------------------------------
To start a new topic, e-mail: users@...
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: mod_jk failover and preferring localhost

by David Rees :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 6/22/06, Per Johnsson <Per.Johnsson@...> wrote:
> Is 1.2.16 avaiable for download somewhere?

Not that I know of, you have to grab the source from SVN.

> Found this:
> http://tomcat.apache.org/connectors-doc/news/20060505.html

I wonder how that got there!

-Dave

---------------------------------------------------------------------
To start a new topic, e-mail: users@...
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: mod_jk failover and preferring localhost

by Rainer Jung-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

We just now tagged 1.2.16. A release candidate is available. Please have
a look at

http://marc.theaimsgroup.com/?l=tomcat-dev&m=115194553720728&w=2

Test results are welcome. If no new problems will be found, the release
vote will procees starting Friday.

The final release will be announced on this list and on the dev list.

David Rees schrieb:

> On 6/22/06, Per Johnsson <Per.Johnsson@...> wrote:
>> Is 1.2.16 avaiable for download somewhere?
>
> Not that I know of, you have to grab the source from SVN.
>
>> Found this:
>> http://tomcat.apache.org/connectors-doc/news/20060505.html
>
> I wonder how that got there!
>
> -Dave
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@...
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...

---------------------------------------------------------------------
To start a new topic, e-mail: users@...
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: mod_jk failover and preferring localhost

by Rainer Jung-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The new attribute distance will help you. It was first implemented for
version 1.2.16, which is in the process of being released (see my other
answer).

Please test and let us know your results.

thuss2 schrieb:

> We have 10 web servers with Tomcat's running on them and a mod_jk
> configuration to prefer the tomcat on localhost and only failover to another
> machine if the local one fails. This worked fine under our older mod_jk,
> however, we just upgraded to 1.2.15 and now it that the local_worker
> properties are no longer supported, it's load balancing every request.
>
> So I checked out the workers.properties options page:
> http://tomcat.apache.org/connectors-doc/config/workers.html and noticed the
> new distance option so that I can give localhost a distance of 0 and
> everything else a greater distance so that the load balancer should always
> prefer localhost. However, it seems to be ignoring the distance property
> completely and load balancing every request. Can anyone suggest what I might
> try to get it to always use the local tomcat for requests unless it fails:
>
> worker.list=tomcat
> worker.tomcat.type=lb
> worker.tomcat.socket_timeout=195
> worker.tomcat.balance_workers=localhost,latin1,latin2,...
> worker.tomcat.sticky_session=False
>
> worker.localhost.port=8009
> worker.localhost.host=localhost
> worker.localhost.type=ajp13
> worker.localhost.lbfactor=1
> worker.localhost.distance=0
>
> worker.latin1.port=8009
> worker.latin1.host=latin1
> worker.latin1.type=ajp13
> worker.latin1.lbfactor=1
> worker.latin1.distance=1
>
> worker.latin2.port=8009
> worker.latin2.host=latin2
> worker.latin2.type=ajp13
> worker.latin2.lbfactor=1
> worker.latin2.distance=1
>
> Thanks,
> Todd
>
> --
> View this message in context: http://www.nabble.com/mod_jk-failover-and-preferring-localhost-t1825380.html#a4979143
> Sent from the Tomcat - User forum at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@...
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...

---------------------------------------------------------------------
To start a new topic, e-mail: users@...
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: mod_jk failover and preferring localhost

by daneturner :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I just tested with mod_jk 1.2.19 and it still seems as though the distance parameter is being ignored.  Output from the status/monitor.page shows mod_jk alternating between tomcats with different distance values in workers.properties.  

How can I troubleshoot this further?

Here's my workers.properties...

dane@nuked:/usr/local/etc/apache$ cat workers.properties
workers.tomcat_home=/usr/local/tomcat5.5
workers.java_home=/usr/local/jdk
ps=/
worker.list=tomcat

worker.tomcat.type=lb
worker.tomcat.socket_timeout=195
worker.tomcat.balance_workers=localhost,ritin
worker.tomcat.sticky_session=False

worker.localhost.port=8009
worker.localhost.socket_timeout=195
worker.localhost.host=localhost
worker.localhost.type=ajp13
workers.localhost.distance=10
worker.localhost.lbfactor=1

worker.ritin.port=8009
worker.ritin.host=ritin
worker.ritin.type=ajp13
workers.localhost.distance=20
worker.ritin.lbfactor=1


And some version information...

dane@nuked:~$ grep mod_jk /var/log/apache/error_log |tail -1
[Thu Dec  7 16:13:04 2006] [notice] Apache/1.3.37 (Unix) mod_perl/1.29 mod_ssl/2.8.28 OpenSSL/0.9.7e-p1 mod_jk/1.2.19 configured -- resuming normal operations


Dane

Rainer Jung-3 wrote:
The new attribute distance will help you. It was first implemented for
version 1.2.16, which is in the process of being released (see my other
answer).

Please test and let us know your results.

thuss2 schrieb:
> We have 10 web servers with Tomcat's running on them and a mod_jk
> configuration to prefer the tomcat on localhost and only failover to another
> machine if the local one fails. This worked fine under our older mod_jk,
> however, we just upgraded to 1.2.15 and now it that the local_worker
> properties are no longer supported, it's load balancing every request.
>
> So I checked out the workers.properties options page:
> http://tomcat.apache.org/connectors-doc/config/workers.html and noticed the
> new distance option so that I can give localhost a distance of 0 and
> everything else a greater distance so that the load balancer should always
> prefer localhost. However, it seems to be ignoring the distance property
> completely and load balancing every request. Can anyone suggest what I might
> try to get it to always use the local tomcat for requests unless it fails:
>
> worker.list=tomcat
> worker.tomcat.type=lb
> worker.tomcat.socket_timeout=195
> worker.tomcat.balance_workers=localhost,latin1,latin2,...
> worker.tomcat.sticky_session=False
>
> worker.localhost.port=8009
> worker.localhost.host=localhost
> worker.localhost.type=ajp13
> worker.localhost.lbfactor=1
> worker.localhost.distance=0
>
> worker.latin1.port=8009
> worker.latin1.host=latin1
> worker.latin1.type=ajp13
> worker.latin1.lbfactor=1
> worker.latin1.distance=1
>
> worker.latin2.port=8009
> worker.latin2.host=latin2
> worker.latin2.type=ajp13
> worker.latin2.lbfactor=1
> worker.latin2.distance=1
>
> Thanks,
> Todd
>
> --
> View this message in context: http://www.nabble.com/mod_jk-failover-and-preferring-localhost-t1825380.html#a4979143
> Sent from the Tomcat - User forum at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org

Re: mod_jk failover and preferring localhost

by Rainer Jung-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Short answer for your question:

the two lines you tried to use as a distance configuration both have typos:

> workers.localhost.distance=10
> workers.localhost.distance=20

workers -> worker
localhost -> ritin (once)

I just did a quick test with 1.2.20 (there should no be change wrt.
distance between 19 and 20) and it worked.

Regards,

Rainer

daneturner schrieb:

> I just tested with mod_jk 1.2.19 and it still seems as though the distance
> parameter is being ignored.  Output from the status/monitor.page shows
> mod_jk alternating between tomcats with different distance values in
> workers.properties.  
>
> How can I troubleshoot this further?
>
> Here's my workers.properties...
>
> dane@nuked:/usr/local/etc/apache$ cat workers.properties
> workers.tomcat_home=/usr/local/tomcat5.5
> workers.java_home=/usr/local/jdk
> ps=/
> worker.list=tomcat
>
> worker.tomcat.type=lb
> worker.tomcat.socket_timeout=195
> worker.tomcat.balance_workers=localhost,ritin
> worker.tomcat.sticky_session=False
>
> worker.localhost.port=8009
> worker.localhost.socket_timeout=195
> worker.localhost.host=localhost
> worker.localhost.type=ajp13
> workers.localhost.distance=10
> worker.localhost.lbfactor=1
>
> worker.ritin.port=8009
> worker.ritin.host=ritin
> worker.ritin.type=ajp13
> workers.localhost.distance=20
> worker.ritin.lbfactor=1
>
>
> And some version information...
>
> dane@nuked:~$ grep mod_jk /var/log/apache/error_log |tail -1
> [Thu Dec  7 16:13:04 2006] [notice] Apache/1.3.37 (Unix) mod_perl/1.29
> mod_ssl/2.8.28 OpenSSL/0.9.7e-p1 mod_jk/1.2.19 configured -- resuming normal
> operations
>
>
> Dane
>
>
> Rainer Jung-3 wrote:
>> The new attribute distance will help you. It was first implemented for
>> version 1.2.16, which is in the process of being released (see my other
>> answer).
>>
>> Please test and let us know your results.
>>
>> thuss2 schrieb:
>>> We have 10 web servers with Tomcat's running on them and a mod_jk
>>> configuration to prefer the tomcat on localhost and only failover to
>>> another
>>> machine if the local one fails. This worked fine under our older mod_jk,
>>> however, we just upgraded to 1.2.15 and now it that the local_worker
>>> properties are no longer supported, it's load balancing every request.
>>>
>>> So I checked out the workers.properties options page:
>>> http://tomcat.apache.org/connectors-doc/config/workers.html and noticed
>>> the
>>> new distance option so that I can give localhost a distance of 0 and
>>> everything else a greater distance so that the load balancer should
>>> always
>>> prefer localhost. However, it seems to be ignoring the distance property
>>> completely and load balancing every request. Can anyone suggest what I
>>> might
>>> try to get it to always use the local tomcat for requests unless it
>>> fails:
>>>
>>> worker.list=tomcat
>>> worker.tomcat.type=lb
>>> worker.tomcat.socket_timeout=195
>>> worker.tomcat.balance_workers=localhost,latin1,latin2,...
>>> worker.tomcat.sticky_session=False
>>>
>>> worker.localhost.port=8009
>>> worker.localhost.host=localhost
>>> worker.localhost.type=ajp13
>>> worker.localhost.lbfactor=1
>>> worker.localhost.distance=0
>>>
>>> worker.latin1.port=8009
>>> worker.latin1.host=latin1
>>> worker.latin1.type=ajp13
>>> worker.latin1.lbfactor=1
>>> worker.latin1.distance=1
>>>
>>> worker.latin2.port=8009
>>> worker.latin2.host=latin2
>>> worker.latin2.type=ajp13
>>> worker.latin2.lbfactor=1
>>> worker.latin2.distance=1
>>>
>>> Thanks,
>>> Todd
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/mod_jk-failover-and-preferring-localhost-t1825380.html#a4979143
>>> Sent from the Tomcat - User forum at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To start a new topic, e-mail: users@...
>>> To unsubscribe, e-mail: users-unsubscribe@...
>>> For additional commands, e-mail: users-help@...
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@...
>> To unsubscribe, e-mail: users-unsubscribe@...
>> For additional commands, e-mail: users-help@...
>>
>>
>>
>

---------------------------------------------------------------------
To start a new topic, e-mail: users@...
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: mod_jk failover and preferring localhost

by daneturner :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Rainer Jung-3 wrote:
Short answer for your question:

the two lines you tried to use as a distance configuration both have typos:

> workers.localhost.distance=10
> workers.localhost.distance=20

workers -> worker
localhost -> ritin (once)
Ouch.  How stupid.

Thanks for the correction.  Problem solved.  Apologies for the sloppy post :-\

Dane

Re: mod_jk failover and preferring localhost

by Rainer Jung-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

daneturner schrieb:

>
> Rainer Jung-3 wrote:
>> Short answer for your question:
>>
>> the two lines you tried to use as a distance configuration both have
>> typos:
>>
>>> workers.localhost.distance=10
>>> workers.localhost.distance=20
>> workers -> worker
>> localhost -> ritin (once)
>>
>
> Ouch.  How stupid.
>
> Thanks for the correction.  Problem solved.  Apologies for the sloppy post
> :-\

Accepted :)

---------------------------------------------------------------------
To start a new topic, e-mail: users@...
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...