Hi John,

Le lundi 6 décembre 2010 21:23:14, John Carter a écrit :
> Hi Everybody,
> 
> I'm tying to make backup servers not enter the persistence table, but as
> yet , I have had no success

There is currently no keyword to allow that.
I remembered someone already asked for this, and just realized it was you :-)
See Willy's answer : http://www.formilux.org/archives/haproxy/1009/3865.html

> I was thinking that I could stop a server being entered in to the
> persistent table like this:
> 
> r...@vm11:/etc/haproxy# cat haproxy.cfg
> (...)
> backend B1
>     acl no_persist_backup dst 192.168.30.47
>     mode tcp
>     option persist
>     stick-table type ip size 10240k expire 30m
>     stick on src unless no_persist_backup
>     stick on src if !localhost
>     balance leastconn
>     server R1 192.168.30.201:80 weight 1 check port 80 inter 2000 rise 2
> fall 3
>     server R2 192.168.30.202:80 weight 1 check port 80 inter 2000 rise 2
> fall 3
>     server  backup 192.168.30.47:80 backup
>     option redispatch
>     option abortonclose
> 
> but alas , my efforts seem in vain. I am doing something wrong ?

The "dst" acl can't work in your case because if the server is already known, 
it means that the stick rule has already been applied.

But maybe there's an alternative solution : you could split your backend in 2 
parts, one for the main servers, and one for the backup ones. Then, your 
frontend can use the backup backend if the main one has no UP servers.

Which could look like :
...
frontend F1
    bind 192.168.35.201:80
    default_backend B1
    acl B1_DOWN nbsrv(B1) 0
    use_backend B1_backup if B1_DOWN
    mode tcp

backend B1
    mode tcp
    option persist
    stick-table type ip size 10240k expire 30m
    stick on src if !LOCALHOST
    balance leastconn
   server R1 192.168.30.201:80 weight 1 check port 80 inter 2000 rise 2 fall 3
   server R2 192.168.30.202:80 weight 1 check port 80 inter 2000 rise 2 fall 3
    option redispatch
    option abortonclose

backend B1_backup
    mode tcp
    balance leastconn
    server  backup 192.168.30.47:80 backup
    option abortonclose

-- 
Cyril Bonté

Reply via email to