Hi Baptiste.
(cc: HAProxy mailing-list)

I recently came across one of your posts from last year 
(http://permalink.gmane.org/gmane.comp.web.haproxy/22841) regarding how DNS 
records are resolved when loading new configuration values (either at parsing 
during initial startup, or on dynamic reconfiguration via the socket). In this 
post, you are referring to a possible enhancement:

Currently, HAProxy works like this: "init-addr libc,dns"
A new value could be "init-addr dns"
Or "init-addr 1.2.3.4,dns"

I believe none of this has been implemented yet, am I right? I am running into 
a situation I would like the latter — a condition can exist where my HAproxy 
would load before some of my backend server entries can be successfully 
resolved.

I tried something that seems to fit my particular need and I’d like to share 
with you and all — please see file-attach.

Essentially, this adds a new global option “override-nxdomain” that can be 
used, as its name implies, to override the return value when HAproxy uses the 
systems DNS resolution and receives the indication the hostname can’t be found. 
A possible use-case is to override (for example) with “localhost” or 
“127.0.0.1” directly so that HAproxy can initially start even if some records 
can’t be resolved yet. Once HAproxy starts to resolve on its own upon checking 
for health of the backend member, it will try to resolve again and hopefully 
get a valid answer at some point.

It seems to pass simple sanity/functionnal tests, but bear in mind this is my 
first submission to HAproxy and I would accept if it is considered a hack at 
this point. :-)

Attachment: haproxy-1.6.4-nxdomain.diff
Description: haproxy-1.6.4-nxdomain.diff

 
Thank you,

Michel Belleau 


Reply via email to