I’m trying to use HAProxy 1.6.5 w/Docker 1.11.1 to proxy to mysql servers. Config file has the following:
resolvers docker
nameserver dns 127.0.0.11:53
listen mysql-global
bind :3306
server db-global db-global:3306 check resolvers docker resolve-prefer ipv4
When I start HAProxy without having db-global running yet (and therefore have its name resolve), HAProxy exits with error:
[ALERT] 148/192216 (225) : parsing [/etc/haproxy.cfg:42] : 'server db-global' : invalid address: 'db-global' in 'db-global:3306'
How do I configure HAProxy to not error out, but to just keep checking the docker internal DNS until ‘db-global’ resolves to an IP and then use that IP to do the check to see if the backend server is UP?
I want to avoid having to start all my containers in some strict order to bring the app up with Docker. My app’s dependencies are statically defined so I don’t want to bother starting HAProxy with an empty config and then reloading a config after the dependencies are UP and running.
Or, is reloading the config my only option?
It would be easier if DNS names that don’t resolve simply mark that server DOWN and keep checking until it does resolve and the check indicates that the server is UP.