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