haproxy fails at startup when using server name instead of IP
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
haproxy (Ubuntu) |
Expired
|
Undecided
|
Unassigned |
Bug Description
This is similar to #689734 I believe.
When starting haproxy using a DNS name on the 'server' line haproxy fails to start, giving the message:
```
May 05 19:09:40 hyrule systemd[1]: Starting HAProxy Load Balancer...
May 05 19:09:40 hyrule haproxy[1146]: [ALERT] 124/190940 (1146) : parsing [/etc/haproxy/
May 05 19:09:40 hyrule haproxy[1146]: [ALERT] 124/190940 (1146) : Failed to initialize server(s) addr.
May 05 19:09:40 hyrule systemd[1]: haproxy.service: Control process exited, code=exited status=1
May 05 19:09:40 hyrule systemd[1]: haproxy.service: Failed with result 'exit-code'.
May 05 19:09:40 hyrule systemd[1]: Failed to start HAProxy Load Balancer.
```
In this case the server statement was:
` server scanmon myservername.
Changing it to use the IP address corrected the problem.
I believe there is a missing dependency for DNS in the unit file.
--Info:
Description: Ubuntu 18.04 LTS
Release: 18.04
haproxy:
Installed: 1.8.8-1
Candidate: 1.8.8-1
Version table:
*** 1.8.8-1 500
500 http://
100 /var/lib/
Thanks for filing this bug in Ubuntu.
I tried a simple case of bringing up two lxd containers, one with haproxy as the frontend, another one with just apache as the backend, and this config file on the frontend:
(defaults from the package go here)
frontend mycontainer
bind *:9090
mode http
default_backend myapache
backend myapache backend. lxd:80 check
mode http
balance roundrobin
server apache-1 bionic-
I then rebooted this frontend and it picked up the bionic-backend.lxd ip just fine via dns.
This sounds indeed like some sort of race condition during boot. It happens only after you reboot a machine? After the boot, if you login and issue a "systemctl restart haproxy", it then works?
Could you share some details about the networking setup of this machine? For example: interfaces /etc/network/ interfaces. d/*
cat /etc/network/
cat /etc/netplan/*.yaml
cat /etc/hosts
cat /etc/resolv.conf
Also, does this machine have a wired network connection, or does it depend on wifi and someone logging in on gnome to activate network-manager and its wifi connection?