Re: Using acls to check if # connections less than number of up servers

2009-04-12 Thread Willy Tarreau
On Tue, Apr 07, 2009 at 02:58:27PM -0700, Karl Pietri wrote:
> Hey all I'm trying to use Acls to have a priority queue of servers for a
> special ip/port and fail over to the regular section and i'm wondering if
> its possible to have an acl that would check if dst_conn gt nbsrv(backend);
>  the code works fine as it is, but if one server is down in the priority
> farm then the check to send it to the bigger farm doesn't pass properly as
> its checking for 3 not 2.  Any help would be appreciated.  The section of
> code is copied below showing what i currently have.

I think that what you want can be achieved using connslots. Your frontend
config would look approximately like this :

frontend internal_api_rails_farm 192.168.1.2:80
mode http
option forwardfor
acl priority_full connslots(priority_rails_farm) eq 0
acl priority_down nbsrv(priority_rails_farm) lt 1
use_backend rails_farm if priority_full or priority_down
default_backend priority_rails_farm

You need 1.3.17 to use connslots though.

Regards,
Willy




Using acls to check if # connections less than number of up servers

2009-04-07 Thread Karl Pietri
Hey all I'm trying to use Acls to have a priority queue of servers for a
special ip/port and fail over to the regular section and i'm wondering if
its possible to have an acl that would check if dst_conn gt nbsrv(backend);
 the code works fine as it is, but if one server is down in the priority
farm then the check to send it to the bigger farm doesn't pass properly as
its checking for 3 not 2.  Any help would be appreciated.  The section of
code is copied below showing what i currently have.
-Karl

frontend internal_api_rails_farm 192.168.1.2:80
mode http
option forwardfor
acl priority_full dst_conn gt 3
acl priority_down nbsrv(priority_rails_farm) lt 1
use_backend rails_farm if priority_full or priority_down
default_backend priority_rails_farm

frontend railsfarm 192.168.1.12:80
mode http
default_backend rails_farm

backend priority_rails_farm
mode http
balance roundrobin
option httpchk GET /status
option httpclose
option abortonclose
option redispatch
contimeout  5000
srvtimeout  5000
server app02_20 192.168.1.4:6020 maxconn 1 maxqueue 2 check inter 2500
fastinter 1000 downinter 1000 rise 2 fall 2
server app03_20 192.168.1.5:6020 maxconn 1 maxqueue 2 check inter 2500
fastinter 1000 downinter 1000 rise 2 fall 2
server app04_20 192.168.1.6:6020 maxconn 1 maxqueue 2 check inter 2500
fastinter 1000 downinter 1000 rise 2 fall 2

backend rails_farm
mode http
balance roundrobin
option httpchk GET /status
option httpclose
option abortonclose
option redispatch
contimeout  25000
srvtimeout  25000
server app01_1 192.168.1.3:6001  maxconn 1 maxqueue 2 check inter 5000
fastinter 1000 downinter 1000 rise 2 fall 2
server app01_2 192.168.1.3:6002  maxconn 1 maxqueue 2 check inter 5000
fastinter 1000 downinter 1000 rise 2 fall 2
server app01_3 192.168.1.3:6003  maxconn 1 maxqueue 2 check inter 5000
fastinter 1000 downinter 1000 rise 2 fall 2
server app01_4 192.168.1.3:6004  maxconn 1 maxqueue 2 check inter 5000
fastinter 1000 downinter 1000 rise 2 fall 2
server app01_5 192.168.1.3:6005  maxconn 1 maxqueue 2 check inter 5000
fastinter 1000 downinter 1000 rise 2 fall 2
server app01_6 192.168.1.3:6006  maxconn 1 maxqueue 2 check inter 5000
fastinter 1000 downinter 1000 rise 2 fall 2
...way more server entries