On Mon, Jul 3, 2017 at 11:52 PM, Baptiste <[email protected]> wrote:

>
>
> On Mon, Jul 3, 2017 at 9:32 AM, Igor Cicimov <igorc@encompasscorporation.
> com> wrote:
>
>> Hi,
>>
>> If I remember correctly, there was a feature that was talked about on the
>> mailing list, and was said it should make it into 1.7, where the
>> dns-resolver can work with dns records that return multiple IP's, like lets
>> say:
>>
>> root@ip-10-77-0-94:~# dig +short tomcat.service.consul A
>> 10.77.4.234
>> 10.77.3.227
>>
>> and account for all records returned (till 1.6 the resolver was grabbing
>> only the first IP returned) in terms of load balancing. So I'm testing this
>> with 1.7.7 like this:
>>
>> ​​
>> server tomcats tomcat.service.consul:8080 check resolvers dns_resolvers
>> resolve-prefer ipv4
>>
>> ​instead of:
>>
>> ​​server tomcat1 10.77.4.234:8080 check resolvers dns_resolvers
>> resolve-prefer ipv4
>> ​server tomcat2 10.77.3.227:8080 check resolvers dns_resolvers
>> resolve-prefer ipv4
>>
>> ​to load balance between all ip's, but seeing in the logs messages like
>> this:
>>
>> Jul  3 17:13:15 ip-10-77-0-94 haproxy[22902]: tomcats/tomcats changed its
>> IP from 10.77.3.227 to 10.77.4.234 by dns_resolvers/dns0.
>>
>> ​so does this mean the feature is not implemented yet?​
>>
>> ​Thanks,
>> Igor​
>>
>>
>
> Hi Igor,
>
> For now, you can't replace a couple of "hard coded" server lines by a
> single server line with DNS enabled.
> The second case will make you have in the end a single server in the
> backend.
>
> HAProxy 1.8 will bring the features you need:
> 1. use the server-template line to configure 2 servers (or more) in
> HAProxy while using a single configuration line
> 2. a cache of the DNS response has been implemented and each time a record
> is used, it is internally moved to the bottom of the list, so all IPs will
> be used as best as possible
>
> Example with server-template to apply to your example:
>   server-template tomcat 2 tomcat.service.consul:8080 check resolvers
> dns_resolvers resolve-prefer ipv4
>
> I would also recommend to set 'init-addr none' to prevent HAProxy from
> using libc at configuration parsing. I saw some deployments where the host
> below HAProxy was not be able to resolve an IP address from a consul
> endpoint.
>
> Baptiste
>

​That's awesome, thanks Baptiste! Also appreciate the valuable input
regarding consul. So excited can't wait to try this ​the moment 1.8 shows
up in the ppa.

Cheers,
Igor

Reply via email to