Simple TCP with backup config

From: Michael Miller <>
Date: Fri, 17 Apr 2009 16:47:38 +0100


I am doing some intial testing with HAProxy and have come across a problem I don't seem to be able to resolve.

A summary of what I am initially trying to achieve follows. I am trying to use HAProxy to provide a VIP that passes on a tcp (SMTP as it happens) stream to a backend server. If that server is down, I would like the connection forwarded to a backup server.

Doing some testing and watching the status page reveals that if both servers are configured as normal, rather than backup, servers the tcp connection is rerouted when the initial attempt to connect fails. However, when one server is configured as backup, the connection never gets to the backup server.

The config I am using is:

        log   local0
        log   local1 notice
        maxconn 4096
        pidfile /var/run/

##chroot /usr/share/haproxy
user haproxy group haproxy daemon
spread-checks 10 defaults default_settings log global mode http option httplog option dontlognull option abortonclose ## option allbackups option clitcpka option srvtcpka option forwardfor retries 10 option redispatch maxconn 2000 backlog 256 timeout connect 5000 timeout client 50000 timeout server 10000 listen www-health bind mode http monitor-uri /haproxy stats enable stats uri /stats listen smtp log global bind mode tcp
#option smtpchk HELO haproxy.local
option tcplog balance roundrobin rate-limit sessions 10 timeout connect 10000 timeout client 60000 timeout server 60000 server smtp01 server smtp02 backup

Note that I am trying to avoid using active health checks and am hoping that the tcp connection failure when connecting to the primary will fall back to the backup server. This works as expected when both servers are configured as "active" rather than "backup" servers. Looking at the status page when one is down, the 10 retries against the "down" server are shown and then the tcp connection succeeds to the second server.

Is this a bug that the tcp connection is not forwarded to the backup server, or am I missing some "obvious" configuration settings?

Many thanks,
Mike Received on 2009/04/17 17:47

This archive was generated by hypermail 2.2.0 : 2009/04/17 18:00 CEST