Re: multi location and cookie persistence on SERVERID

2012-01-27 Thread eni-urge...@scan-eco.com

Hello and thank you for your answer.

I thought it was something to do with monitor fail if but i didn't 
understand that it's possible to count the number of server on a backend.


I will test this asap. and write back to the mailing list

Thanks to you for your help and thanks to the dev team of haproxy. I 
really love this product.



Le 27/01/2012 08:11, Baptiste a écrit :

Ok, I understand now why you're doing like that :)

Let me update Willy's example:


frontend site1
bind :80

monitor-uri /check
monitor fail if { nbsrv(local) le 0 }

acl local_ok nbsrv(local) gt 0
acl site2_ok nbsrv(site2) gt 0
acl site3_ok nbsrv(site3) gt 0

acl is_site1 hdr_sub(cookie) SERVERID=a
acl is_site2 hdr_sub(cookie) SERVERID=b
acl is_site3 hdr_sub(cookie) SERVERID=c

use_backend site2 if is_site2 site2_ok
use_backend site3 if is_site3 site3_ok
use_backend site2 if !local_ok site2_ok
use_backend site3 if !local_ok site3_ok

default_backend local

 backend local
# handles site1's traffic as well as non-site specific traffic
# all cookies are prefixed with a
cookie SERVERID
server srv1 1.0.0.1:80 cookie a1 check
server srv2 1.0.0.1:80 cookie a2 check
server srv3 1.0.0.1:80 cookie a3 check

 backend site2
# reroute traffic to site 2's load balancer
option httpchk GET /check
server site2 2.2.2.2:80 check

 backend site3
# reroute traffic to site 2's load balancer
option httpchk GET /check
server site3 3.3.3.3:80 check




Note that I have not tested this example, so there may be some mistake.
The idea here is to count the number of available server in a backend,
then take routing decision based on this information.
Each site must monitor its local backend and provide it's status to
other (monitor* lines) and pick up status from remote backend.

Tell me if you managed to configure your setup.

cheers






Re: multi location and cookie persistence on SERVERID

2012-01-26 Thread eni-urge...@scan-eco.com

hello thank you for your advise.

I dont know why i configure 2 different backend. I think i saw this 
config on a website and thinking that was the best for me.






Le 26/01/2012 07:33, Baptiste a écrit :

Bonjour,

Well, as far as I can see, this is due to your configuration!
Why routing user in the frontend using the persistance cookie?
You should take routing decision based on the number of servers
remaining in a backend or using some options like allbackups and
puting all your server in a single backend with backup keyword for the
servers which are not located locally.

If you need more help for both configuration, let me know.

cheers






Re: multi location and cookie persistence on SERVERID

2012-01-26 Thread eni-urge...@scan-eco.com

I followed some willy's advise in a old mail
http://permalink.gmane.org/gmane.comp.web.haproxy/3238


Le 26/01/2012 17:08, eni-urge...@scan-eco.com a écrit :

hello thank you for your advise.

I dont know why i configure 2 different backend. I think i saw this 
config on a website and thinking that was the best for me.






Le 26/01/2012 07:33, Baptiste a écrit :

Bonjour,

Well, as far as I can see, this is due to your configuration!
Why routing user in the frontend using the persistance cookie?
You should take routing decision based on the number of servers
remaining in a backend or using some options like allbackups and
puting all your server in a single backend with backup keyword for the
servers which are not located locally.

If you need more help for both configuration, let me know.

cheers