I'm trying to configure haproxy to cluster a couple of mysql servers (galera cluster), but it seems that haproxy does not accept dns name in the server
directive.
e.g. config
listen mysql 127.0.0.1:3306
timeout connect 10000
option clitcpka
option srvtcpka
option abortonclose
mode tcp
option mysql-check
balance roundrobin
# this works
server mysql-001 1.2.3.4:3306 check port 3306 check inter 5000
server mysql-002 1.2.3.5:3306 check port 3306 check inter 5000
# this doesn't
server mysql-003 ec2-1-2-3-6.eu-west-01.compute.amazonaws.com:3306 check port 3306 check inter 5000
It complains with error:
[ALERT] 241/152647 (27025) : parsing [/etc/haproxy/haproxy.cfg:26] : 'server mysql-003' : invalid address: 'ec2-1-2-3-6.eu-west-01.compute.amazonaws.com' in 'ec2-1-2-3-6.eu-west-01.compute.amazonaws.com:3306'
The reason I would like to use DNS name here is to simplify the security-group confguration, and be able to use elastic IPs on the nodes.
Is there a way around this problem?