Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to setup cluster with haproxy, I have one load balancer and two nodes. Some how haproxy is only taking one node. It runs fine until one XXX.XX.X.196 is up and running but as soon as i shut it down and try to start haproxy again it give me this error.

I doesnt handle the request when tomcat on XXX.XX.X.196 is shutdown but I still have tomcat on XXX.XX.X.193 up and running.

XXX.XX.X.189: Load Balancer

XXX.XX.X.193: Node 1, Running Apache tomcat

XXX.XX.X.196: Node 2, Running Apache tomcat

        log local2 debug #log using syslog service on localhost
        maxconn     4096 # Total Max Connections. This is dependent on ulimit
    mode        http
    maxconn     4096
    clitimeout  60000
    srvtimeout  30000
    contimeout  4000
    option      httpclose # Disable Keepalive
    log         global
        option      httplog

listen  farm XXX.XX.X.189:80
    mode http
    stats uri /haproxy #show haproxy colsole
    balance roundrobin
       cookie farmID insert #assign a farmID coockie to each client
    option httpclose
    option httpchk
    option forwardfor
    ## Define your servers to balance
    server node1 XXX.XX.X.193:8081 cookie farmID_node1 check
    server node2 XXX.XX.X.196:8081 cookie farmID_node2 check

Thank you.

share|improve this question
define what it a particular service?(server still pings) or the server itself (i.e. will not ping)? In my experience some of the load balancers by default look only for the status of the server not the services. – mdpc Jun 10 '13 at 18:09
Sorry for the confusion, I meant the tomcat server on those machines. (I made the edit on the original post itself) – nth Jun 10 '13 at 18:36
up vote 0 down vote accepted

Can your loadbalancer 'see' both application servers? I.e., do your firewall settings allow the loadbalancer to connect to the app servers on port 8081. Try this from the load-balancer:

curl http://XXX.XX.X.193:8081

And ...

curl http://XXX.XX.X.196:8081

(You'll need to fill out the IP addresses obviously).

You should also check your tomcat logs to see what it's returning to the check requests. A 2xx or a 3xx are 'good' responses.

share|improve this answer
Yes, I can get to the server with curl. I get perfectly good html response. I thought the request is not being redirected but from further looking into it, it turns out that its only the problem with failover not being redirected correctly to another server. I can see the status of haproxy and it shows two machines but somehow its is trying to send the request to the same server even after it fails. – nth Jun 11 '13 at 17:57
Well Its just was taking more time than I anticipated. It does work. Thank you. – nth Jun 11 '13 at 18:26

Your Answer


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.