HAProxy version 2.4.22-f8e3218 2023/02/14
Config is:
global
maxconn 10000
log 127.0.0.1 local2
defaults
log global
mode tcp
retries 2
timeout client 30m
timeout connect 4s
timeout server 30m
timeout check 5s
listen stats
mode http
bind *:7000
stats enable
stats uri /
listen postgres
bind *:5432
option httpchk
http-check expect status 200
default-server inter 3s fall 3 rise 2 on-marked-down shutdown-sessions
server db-patroni-1 11.11.11.1:5432 maxconn 10000 check port 8008
server db-patroni-2 11.11.11.2:5432 maxconn 10000 check port 8008
listen postgres_write
bind *:6432
option httpchk OPTIONS /master
http-check expect status 200
default-server inter 3s fall 3 rise 2 on-marked-down shutdown-sessions
server db-patroni-1 11.11.11.1:6432 maxconn 10000 check port 8008
server db-patroni-2 11.11.11.2:6432 maxconn 10000 check port 8008
listen postgres_read
balance roundrobin
bind *:6433
option httpchk OPTIONS /replica
http-check expect status 200
default-server inter 3s fall 3 rise 2 on-marked-down shutdown-sessions
server db-patroni-1 11.11.11.1:6432 maxconn 10000 check port 8008
server db-patroni-2 11.11.11.2:6432 maxconn 10000 check port 8008
For this configuration our service in kubernetes cluster have lost connections. If we switch connections string in service on patroni server whitout haproxy to connects extend two times. In haproxy logs is evrything ok. Utilazation resources on server ~ 20%. Why server haproxy may lose connection to database, how i can my config is better ?