I'm migrating some infrastructure from multiple servers hosting specific sites to a load-balancing architecture using HAProxy 188.8.131.52 on OpenBSD 4.6 macppc. Naturally, I'm starting with configuring content switching for the current setup (specific sites on specific servers) and my /etc/haproxy/haproxy.cfg is as follows:
global log 127.0.0.1 local0 log 127.0.0.1 local1 notice #log loghost local0 info maxconn 1024 chroot /var/haproxy uid 604 gid 604 daemon #debug #quiet pidfile /var/run/haproxy.pid defaults log global mode http option httplog option dontlognull option redispatch retries 3 maxconn 2000 contimeout 5000 clitimeout 50000 srvtimeout 50000 stats enable stats auth user:pass frontend http_proxy *:80 # check to see which domain the reguest is for acl host_tld.domain.sub1 hdr_end(host) sub1.domain.tld acl host_tld.domain.sub2 hdr_end(host) sub2.domain.tld # send to the correct server use_backend server2 if host_tld.domain.sub1 or host_tld.domain.sub2 default_backend server1 backend server1 server httpd_server1 192.168.1.3:80 backend server2 server httpd_server2 192.168.1.4:80
The goal is for all domains to be served by
server1 except for domains
sub2.domain.tld which should be dished out by
server2 instead. However, when I try to start HAProxy, I get the following errors:
parsing /etc/haproxy/haproxy.cfg : backend 'server2' has no dispatch address and is not in transparent or balance mode. parsing /etc/haproxy/haproxy.cfg : backend 'server1' has no dispatch address and is not in transparent or balance mode. Errors found in configuration file, aborting. Error reading configuration file : /etc/haproxy/haproxy.cfg
I've looked at the examples listed in the HAProxy 1.3 documentation and http://upstre.am/2008/01/09/using-haproxy-with-multiple-backends-aka-content-switching/, but don't see where I've gone wrong. None of the examples seem to require either
option transparent nor a balance mode. Also, the documentation for the
dispatch option is curiously omitted from the 1.3 documentation, but I doubt it would be helpful in my troubleshooting anyway.
Where have I gone wrong?