Quantcast
Channel: HAProxy community - Latest topics
Viewing all articles
Browse latest Browse all 4849

Haproxy doesn't resolve a domain to all the IPs

$
0
0

I’ve created a Docker Compose project with haproxy and 4 replicas of a web server. I’m using server-template to connect haproxy to the replicas:

server-template s 4 app:80 check

But:

$ docker compose exec haproxy host -t a app
app has address 192.168.48.5
app has address 192.168.48.4
app has address 192.168.48.3
app has address 192.168.48.2

$ echo show servers state \
    | docker compose exec -T haproxy socat /var/lib/haproxy/haproxy.sock stdio
1
# be_id be_name srv_id srv_name srv_addr srv_op_state srv_admin_state srv_uweight srv_iweight srv_time_since_last_change srv_check_status srv_check_result srv_check_health srv_check_state srv_agent_state bk_f_forced_id srv_f_forced_id srv_fqdn srv_port srvrecord srv_use_ssl srv_check_port srv_check_addr srv_agent_addr srv_agent_port
2 http 1 s1 192.168.48.2 2 0 1 1 21 15 3 4 6 0 0 0 app 80 - 0 0 - - 0
2 http 2 s2 192.168.48.2 2 0 1 1 21 15 3 4 6 0 0 0 app 80 - 0 0 - - 0
2 http 3 s3 192.168.48.3 2 0 1 1 21 15 3 4 6 0 0 0 app 80 - 0 0 - - 0
2 http 4 s4 192.168.48.5 2 0 1 1 21 15 3 4 6 0 0 0 app 80 - 0 0 - - 0

Sometimes there are no duplicates, but usually there’s a couple of them.

I thought that there’s some sort of race condition here (when haproxy starts the DNS resolver responds with only some IPs), but the behavior is identical after reload:

$ docker compose exec haproxy kill -HUP 1

What am I doing wrong? How do I make haproxy connect to all the servers?

On a side note, set server http/s1 state ready always returns “No such server.” But the command works with http/s2, http/s3, http/s4. Anything wrong on my part here?

8 posts - 3 participants

Read full topic


Viewing all articles
Browse latest Browse all 4849

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>