HAProxy community

Usage of default-server


This works:

server server1:3306 maxconn 65536 check inter 5000 rise 3 fall 3 weight 1 agent-send backend1\ server1\n agent-check agent-addr agent-port 9200  agent-inter 15000

This does not:

default-server agent-check agent-addr agent-port 9200 agent-inter 15000

server server1 server1:3306 maxconn 65536 check inter 5000 rise 3 fall 3 weight 1 agent-send server1\ server1\n

gerardo@lb1:~$ sudo haproxy -vv
HA-Proxy version 1.8.19-1 2019/02/12
Copyright 2000-2019 Willy Tarreau willy@haproxy.org

Build options :
TARGET = linux2628
CPU = generic
CC = gcc
CFLAGS = -O2 -g -O2 -fdebug-prefix-map=/build/haproxy-1.8.19=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fno-strict-aliasing -Wdeclaration-after-statement -fwrapv -Wno-format-truncation -Wno-null-dereference -Wno-unused-label

Default settings :
maxconn = 2000, bufsize = 16384, maxrewrite = 1024, maxpollevents = 200

Built with OpenSSL version : OpenSSL 1.1.1a 20 Nov 2018
Running on OpenSSL version : OpenSSL 1.1.1c 28 May 2019
OpenSSL library supports TLS extensions : yes
OpenSSL library supports SNI : yes
OpenSSL library supports : TLSv1.0 TLSv1.1 TLSv1.2 TLSv1.3
Built with Lua version : Lua 5.3.3
Built with transparent proxy support using: IP_TRANSPARENT IPV6_TRANSPARENT IP_FREEBIND
Encrypted password support via crypt(3): yes
Built with multi-threading support.
Built with PCRE2 version : 10.32 2018-09-10
PCRE2 library supports JIT : yes
Built with zlib version : 1.2.11
Running on zlib version : 1.2.11
Compression algorithms supported : identity(“identity”), deflate(“deflate”), raw-deflate(“deflate”), gzip(“gzip”)
Built with network namespace support.

Available polling systems :
epoll : pref=300, test result OK
poll : pref=200, test result OK
select : pref=150, test result OK
Total: 3 (3 usable), will use epoll.

Available filters :
[SPOE] spoe
[COMP] compression
[TRACE] trace

Help is appreciated.

agent-send backend1\ server1\n

is not the same as:
agent-send server1\ server1\n

Indeed it isn’t, should read backend1\ server1\n in both cases. Sorry.

That is what the actual config says, and still, the default-server version does not work, no connection attempted to 9200 at all. (and if the pair (backend, server) does not exist, the agent would return an error).

Got it to work.

Had to specify agent-addr in each server, default-server was not enough.

Could this be deliberate? My choice here is unusual, to run the check in the LB.