Hi!
Here, actually, I've found the description of the same problem. At
Apache falling/restart, haproxy returns to users 502 error.
> http://www.formilux.org/archives/haproxy/0812/1575.html
Here I give the example of how it looks:
# while true; do echo -n `date "+%T.%N "`" "; curl -s
http://test-nl11-apache-aux2.com/uptime.php; echo; done
12:50:21.294819803 OK
12:50:21.481879293 OK
12:50:21.666777343 OK
...
I stop Apache:
# /opt/apache_aux2_pool1/current/sbin/apachectl -k stop
I receive an error:
...
12:50:21.854037923 OK
12:50:22.039332296 OK
12:50:22.244071674 <html><body><h1>502 Bad Gateway</h1>
The server returned an invalid or incomplete response.
</body></html>
12:50:22.463404198 OK
12:50:22.653188547 OK
...
...
Haproxy log in attach.
My haproxy.conf:
==========
global
daemon
user haproxy
group haproxy
chroot /var/empty
ulimit-n 32000
defaults
log 127.0.0.1 local1 notice
mode http
maxconn 2000
balance roundrobin
option forwardfor except 111.222.111.222/32
option redispatch
retries 10
stats enable
stats uri /haproxy?stats
timeout connect 5000
timeout client 150000
timeout server 150000
listen backend_pool1 111.222.111.222:9099
option httplog
log 127.0.0.1 local2
cookie SERVERID insert indirect
option httpchk
capture request header Host len 40
server pool1 111.222.111.222:8099 weight 256 cookie backend1_pool1
check inter 500 fastinter 100 fall 1 rise 2 maxconn 500
server pool2 111.222.111.222:8100 weight 1 cookie backend1_pool2
check inter 800 fastinter 100 fall 1 rise 2 maxconn 250
server pool3 111.222.111.222:8101 backup
==========
My challenge is to make ha proxy not to return to the user an error
502 at once, but to make it try to repeat the inquiry times
through N time intervals, and if it all failed only then let haproxy
return to the user the 502 error. Can I somehow do it or is there
any other suitable decision?
--
BRGDS. Alexey Vlasov.
Jun 9 10:50:22 nl11 haproxy_aux2_pools[27830]: 111.222.111.222:46445
[09/Jun/2011:10:50:22.074] backend_pool1 backend_pool1/pool2 0/0/0/0/0 200 188
- - --NI 0/0/0/0/0 0/0 {test-nl11-apache-aux2.com:9099} "GET /uptime.php
HTTP/1.1"
Jun 9 10:50:22 nl11 haproxy_aux2_pools[27830]: 111.222.111.222:46449
[09/Jun/2011:10:50:22.262] backend_pool1 backend_pool1/pool2 0/0/0/0/0 200 188
- - --NI 0/0/0/0/0 0/0 {test-nl11-apache-aux2.com:9099} "GET /uptime.php
HTTP/1.1"
Jun 9 10:50:22 nl11 haproxy_aux2_pools[27830]: 111.222.111.222:46461
[09/Jun/2011:10:50:22.451] backend_pool1 backend_pool1/pool1 0/0/0/16/17 200
188 - - --NI 0/0/0/0/0 0/0 {test-nl11-apache-aux2.com:9099} "GET /uptime.php
HTTP/1.1"
Jun 9 10:50:22 nl11 haproxy_aux2_pools[27830]: 111.222.111.222:46463
[09/Jun/2011:10:50:22.659] backend_pool1 backend_pool1/pool1 0/0/0/-1/28 502
204 - - SHNN 0/0/0/0/0 0/0 {test-nl11-apache-aux2.com:9099} "GET /uptime.php
HTTP/1.1"
Jun 9 10:50:22 nl11 haproxy_aux2_pools[27830]: Server backend_pool1/pool1 is
DOWN, reason: Socket error, check duration: 1ms. 1 active and 1 backup servers
left. 0 sessions active, 0 requeued, 0 remaining in queue.
Jun 9 10:50:22 nl11 haproxy_aux2_pools[27830]: 111.222.111.222:46467
[09/Jun/2011:10:50:22.873] backend_pool1 backend_pool1/pool2 0/0/0/1/1 200 188
- - --NI 0/0/0/0/0 0/0 {test-nl11-apache-aux2.com:9099} "GET /uptime.php
HTTP/1.1"
Jun 9 10:50:23 nl11 haproxy_aux2_pools[27830]: 111.222.111.222:46471
[09/Jun/2011:10:50:23.062] backend_pool1 backend_pool1/pool2 0/0/0/0/0 200 188
- - --NI 0/0/0/0/0 0/0 {test-nl11-apache-aux2.com:9099} "GET /uptime.php
HTTP/1.1"
Jun 9 10:50:23 nl11 haproxy_aux2_pools[27830]: 111.222.111.222:46481
[09/Jun/2011:10:50:23.246] backend_pool1 backend_pool1/pool2 0/0/0/0/0 200 188
- - --NI 0/0/0/0/0 0/0 {test-nl11-apache-aux2.com:9099} "GET /uptime.php
HTTP/1.1"
Jun 9 10:50:23 nl11 haproxy_aux2_pools[27830]: 111.222.111.222:46485
[09/Jun/2011:10:50:23.436] backend_pool1 backend_pool1/pool2 0/0/0/0/0 200 188
- - --NI 0/0/0/0/0 0/0 {test-nl11-apache-aux2.com:9099} "GET /uptime.php
HTTP/1.1"