Hello - I'm attempting to use HAProxy's service discovery (SRV records)
along with `load-server-state-from-file` but the port numbers from `show
servers state` are incorrect.

Here is my example (HA-Proxy version 1.9-dev2 2018/09/12)

DNS configuration:

$ dig SRV _nginx._tcp.alpha.int
;; ANSWER SECTION:
_nginx._tcp.alpha.int.  18      IN      SRV     1 1 32772
56b9c088-9bc5-4466-99af-ebebd3550791._nginx._tcp.alpha.int.
_nginx._tcp.alpha.int.  18      IN      SRV     1 1 32773
c6032796-8c7a-4d78-8934-d98900c18383._nginx._tcp.alpha.int.

haroxy.cfg:

global
    pidfile     /var/run/haproxy.pid
    stats socket /haproxy-run/haproxy.sock
    server-state-file /haproxy-run/haproxy.state

defaults
    mode        http
    timeout connect 10000
    timeout client 100000
    timeout server 100000
    load-server-state-from-file global

resolvers resolver0
    nameserver dns0 172.20.0.2:53

frontend http
    bind *:80
    default_backend b1

backend b1
    server-template www 2 _nginx._tcp.alpha.int check resolvers resolver0

server state:

$ echo "show servers state b1" | sudo socat haproxy-run/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
3 b1 1 www1 172.20.2.109 2 0 1 1 13 6 3 4 6 0 0 0
56b9c088-9bc5-4466-99af-ebebd3550791._nginx._tcp.alpha.int 4294934532
_nginx._tcp.alpha.int
3 b1 2 www2 172.20.0.192 2 0 1 1 12 6 3 4 6 0 0 0
c6032796-8c7a-4d78-8934-d98900c18383._nginx._tcp.alpha.int 4294934533
_nginx._tcp.alpha.int


As you can see, the port number in the SRV records are:
32772
32773

However, the srv_port value from `show servers state` is:
4294934532
4294934533

This causes the following error when haproxy attempts to read the state
file:
[WARNING] 261/162616 (1) : server-state application failed for server
'b1/www1', invalid srv_port value '4294934532'
[WARNING] 261/162616 (1) : server-state application failed for server
'b1/www2', invalid srv_port value '4294934533'

Can anyone help me out?

Thanks,
Pete

Reply via email to