jnewland (owner)

Revisions

gist: 25482 Download_button fork
public
Public Clone URL: git://gist.github.com/25482.git
haproxy.conf
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
global
  # maximum number of simultaneous active connections from an upstream web server
  maxconn 500
 
  # Logging to syslog facility local0
  # log 127.0.0.1 local0
 
  # Distribute the health checks with a bit of randomness
  spread-checks 5
 
  # Uncomment the statement below to turn on verbose logging
  #debug
 
# Settings in the defaults section apply to all services (unless you change it,
# this configuration defines one service, called rails).
defaults
 
  # apply log settings from the global section above to services
  log global
 
  # Proxy incoming traffic as HTTP requests
  mode http
 
  # Distribute incoming requests between Mongrels by round robin algorythm.
  # Note that because of 'maxconn 1' settings in the listen section, Mongrels
  # that are busy processing some other request will actually be skipped.
  # So, the actual load-balancing behavior is smarter than simple round robin.
  balance roundrobin
 
  # Maximum number of simultaneous active connections from an upstream web server
  # per service
  maxconn 500
 
  # Log details about HTTP requests
  option httplog
 
  # Abort request if client closes its output channel while waiting for the
  # request. HAProxy documentation has a long explanation for this option.
  option abortonclose
 
  # Check if a "Connection: close" header is already set in each direction,
  # and will add one if missing.
  option httpclose
 
  # If sending a request to one Mongrel fails, try to send it to another, 3 times
  # before aborting the request
  retries 3
 
  # Do not enforce session affinity (i.e., an HTTP session can be served by
  # any Mongrel, not just the one that started the session
  option redispatch
 
  # Timeout a request if the client did not read any data for 120 seconds
  timeout client 120000
 
  # Timeout a request if Mongrel does not accept a connection for 120 seconds
  timeout connect 120000
 
  # Timeout a request if Mongrel does not accept the data on the connection,
  # or does not send a response back in 120 seconds
  timeout server 120000
  
  # Remove the server from the farm gracefully if the health check URI returns
  # a 404. This is useful for rolling restarts.
  http-check disable-on-404
 
  # Enable the statistics page
  stats enable
  stats uri /haproxy?stats
  stats realm Haproxy\ Statistics
  stats auth haproxy:stats
 
  # Create a monitorable URI which returns a 200 if haproxy is up
  monitor-uri /haproxy?monitor
 
  # Specify the HTTP method and URI to check to ensure the server is alive.
  # see http://github.com/jnewland/pulse
  #option httpchk GET /pulse
 
  # Amount of time after which a health check is considered to have timed out
  timeout check 2000
 
# Rails service section.
listen rails :8000
  server rails-1 localhost:8001 maxconn 1 check inter 20000 fastinter 1000 fall 1
  server rails-2 localhost:8002 maxconn 1 check inter 20000 fastinter 1000 fall 1
  server rails-3 localhost:8003 maxconn 1 check inter 20000 fastinter 1000 fall 1
  server rails-4 localhost:8004 maxconn 1 check inter 20000 fastinter 1000 fall 1
  server rails-5 localhost:8005 maxconn 1 check inter 20000 fastinter 1000 fall 1
  server rails-6 localhost:8006 maxconn 1 check inter 20000 fastinter 1000 fall 1
  server rails-7 localhost:8007 maxconn 1 check inter 20000 fastinter 1000 fall 1
  server rails-8 localhost:8008 maxconn 1 check inter 20000 fastinter 1000 fall 1
  server rails-9 localhost:8009 maxconn 1 check inter 20000 fastinter 1000 fall 1
  server rails-10 localhost:8010 maxconn 1 check inter 20000 fastinter 1000 fall 1