On 8/01/10 1:31 AM, Willy Tarreau wrote:
Hi,
On Fri, Jan 08, 2010 at 12:51:46AM +1100, Aristedes Maniatis wrote:
I'm working on a web UI for administering the haproxy config and I have a
question I can't find the answer to in the documentation. Are the listener
blocks unique with respect to IP:port? That is, is this valid:
listen
bind 1.2.3.4:80
acl someAcl...
server 1.2.5.1 ifsomeAcl
listen
bind 1.2.3.4:80
acl someOtherAcl...
server 1.2.5.1 if someOtherAcl
Are these listeners like a Unix listener, only one unique IP:port pair is
allowed. Or are duplicates OK and they are executed in order from the top
to the bottom under a backend server is matched?
This depends on the OS in fact. Haproxy accepts such a configuration, but
on most OSes it will not be able to bind the port for the second instance
because the OS will refuse to bind it a second time.
Thanks for that clarification. So to implement virtual hosts (which need to do
in order to keep the health checks separated per virtual host, not per backend
server) we'll end up with one great big listen block with lots of ACLs each
pointing requests to the correct backend.
I think that's clear: you might want to add to the documentation that the
'bind' directive creates an OS level listener which corresponds to what you see
in netstat. That might help clarify for others.
Ari
--
-------------------------->
Aristedes Maniatis
ish
http://www.ish.com.au
Level 1, 30 Wilson Street Newtown 2042 Australia
phone +61 2 9550 5001 fax +61 2 9550 4001
GPG fingerprint CBFB 84B4 738D 4E87 5E5C 5EFA EF6A 7D2E 3E49 102A