Re: How to check backend servers thru Haproxy?

From: Guillaume Bourque <guillaume.bourque#gmail.com>
Date: Fri, 27 May 2011 08:27:51 -0400


Hi Willy,

should those two lines

       server srv1 1.1.1.1:80 cookie s1
       server srv2 1.1.1.2:80 cookie s2

be

       server srv1 1.1.1.1:80 <http://1.1.1.1/> cookie srv1
       server srv2 1.1.1.2:80 <http://1.1.1.2/> cookie srv2

Not sure but since I can't test right now i thought to ask the master ;-)

thnaks

Yes you can do that using the "force-persist" statement. The principle
> is that you define with ACLs how to detect that an incoming request is
> in fact one of your tests. That could be an IP address, a user-agent,
> or a cookie for example. Many people like the cookie because you already
> need to force one for the persistence, so if you can force one, you can
> force a second one. When this rule is matched, then haproxy will send
> your request to the server associated with the persistence cookie,
> whatever its state, and will not redispatch the request in case of
> failure. This statement was created exactly for the need you describe
> here.
>
> So let's consider the following setup :
>
> listen pub
> bind :80
> cookie SRV
> server srv1 1.1.1.1:80 cookie s1
> server srv2 1.1.1.2:80 cookie s2
> acl its_me hdr_sub(cookie) TEST=true
> force-persist if its_me
>
> Then you configure your browser to send two cookies :
>
> SRV=srv1
> TEST=true
>
> and you send any request you want there. You'll always be sent
> to server1.
>
> Cheers,
> Willy
>
>
>

-- 
Guillaume Bourque, B.Sc.,
consultant, infrastructures technologiques libres
514 576-7638,  http://ca.linkedin.com/in/GuillaumeBourque/fr
Received on 2011/05/27 14:27

This archive was generated by hypermail 2.2.0 : 2011/05/27 14:30 CEST