Willy Tarreau | 4689ae6 | 2007-11-30 15:23:38 +0100 | [diff] [blame] | 1 | # This is a test configuration. |
| 2 | # It makes use of a farm built from 4 active servers and 4 backup servers, |
| 3 | # all listenening to different IP addresses on port 80. Health-checks are |
| 4 | # TCP only on port 81 so that iptables rules permit easy selection of which |
| 5 | # servers are enabled or disabled. It checks for the file /alive, and disables |
| 6 | # the server if the response is 404. |
| 7 | # |
| 8 | # Create statistics counters this way : |
| 9 | # |
| 10 | # iptables -N http |
| 11 | # iptables -A OUTPUT -p tcp --syn --dport 80 -j http |
| 12 | # for i in $(seq 1 8); do iptables -A http -d 127.0.0.$i; done |
| 13 | # iptables -A http -d 127.0.0.0/24 |
| 14 | # |
| 15 | # Consult the statistics using iptables this way: |
| 16 | # |
| 17 | # iptables --line-numbers -nxvL http |
| 18 | # iptables -Z http |
| 19 | # |
| 20 | # Block individual servers like this : |
| 21 | # iptables -I INPUT -p tcp --dport 81 -d 127.0.0.1 -j DROP |
| 22 | # |
| 23 | # Enable each server like this : |
| 24 | # touch $SRV_ROOT/alive |
| 25 | # |
| 26 | # Disable each server like this : |
| 27 | # rm -f $SRV_ROOT/alive |
| 28 | # |
| 29 | |
| 30 | global |
| 31 | maxconn 1000 |
| 32 | stats socket /tmp/sock1 mode 600 |
| 33 | stats timeout 3000 |
| 34 | stats maxconn 2000 |
| 35 | |
| 36 | listen sample1 |
| 37 | mode http |
| 38 | retries 1 |
| 39 | redispatch |
| 40 | contimeout 1000 |
| 41 | clitimeout 5000 |
| 42 | srvtimeout 5000 |
| 43 | maxconn 40000 |
| 44 | bind :8080 |
| 45 | cookie SRV insert indirect nocache |
| 46 | #balance source |
| 47 | balance roundrobin |
| 48 | option allbackups |
| 49 | server act1 127.0.0.1:80 cookie a1 weight 10 check port 81 inter 1000 fall 4 |
| 50 | server act2 127.0.0.2:80 cookie a2 weight 20 check port 81 inter 1000 fall 4 |
| 51 | server act3 127.0.0.3:80 cookie a3 weight 30 check port 81 inter 1000 fall 4 |
| 52 | server act4 127.0.0.4:80 cookie a4 weight 40 check port 81 inter 1000 fall 4 |
| 53 | server bck1 127.0.0.5:80 cookie b1 weight 10 check port 81 inter 1000 fall 4 backup |
| 54 | server bck2 127.0.0.6:80 cookie b2 weight 20 check port 81 inter 1000 fall 4 backup |
| 55 | server bck3 127.0.0.7:80 cookie b3 weight 30 check port 81 inter 1000 fall 4 backup |
| 56 | server bck4 127.0.0.8:80 cookie b4 weight 40 check port 81 inter 1000 fall 4 backup |
| 57 | option httpclose |
| 58 | stats uri /stats |
| 59 | stats refresh 5 |
| 60 | option httpchk GET /alive |
| 61 | http-check disable-on-404 |