Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

My understanding was that with two server backends load-balanced by HAProxy , if one goes down, HAProxy should be able to direct all traffic to the other.

I have two loadbalaced webservers, with roundrobin and httpchk, but when one goes down I get 503 - Service unavailable messages from HAProxy. Perhaps there is something wrong with my config?

backend app
    timeout server 50000ms
    mode http
    balance roundrobin
    option httpchk

    server ap1 ap1:8000 maxconn 4000 #ap1 is hostname
    server ap2 ap2:8000 maxconn 4000 #ap2 is hostname
share|improve this question

1 Answer 1

up vote 2 down vote accepted

Maybe it helps if you add an explicit URL to your httpchk - per default it uses an http OPTION on /. Also you have to add the "check" keyword to your host definitions (http://haproxy.1wt.eu/download/1.3/doc/haproxy-en.txt section 3.1)

backend app
    timeout server 50000ms
    mode http
    balance roundrobin
    option httpchk HEAD /some/valid/url

    server ap1 ap1:8000 maxconn 4000 check #ap1 is hostname
    server ap2 ap2:8000 maxconn 4000 check #ap2 is hostname
share|improve this answer
    
Ah - missed the check. I'll add that and see (the default url should be ok, but I've explicitly added one now anyway). Thank you. –  UpTheCreek May 14 '13 at 9:50
    
Working well now thank you. –  UpTheCreek May 14 '13 at 10:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.