didi-lot2-backend/backend/services/data-layer/didiDatabase/ha-cluster/haproxy/haproxy.cfg
2026-07-10 03:39:53 -07:00

46 lines
1.3 KiB
INI
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# HAProxy for DIDI PostgreSQL HA — routes by Patroni REST health checks.
# Mirrors the production LB config (10.11.50.166/169 → VIP 167).
#
# :5000 → the ONE node whose Patroni answers 200 on /primary (leader, RW)
# :5001 → nodes answering 200 on /replica (round-robin, RO)
#
# On failover Patroni flips the health endpoints; HAProxy reroutes in
# (inter × fall) ≈ 9s worst case without client config changes.
global
maxconn 300
log stdout format raw local0
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_write
bind *:5000
option httpchk GET /primary
http-check expect status 200
default-server inter 3s fall 3 rise 2 on-marked-down shutdown-sessions
server pg-node1 pg-node1:5432 check port 8008
server pg-node2 pg-node2:5432 check port 8008
server pg-node3 pg-node3:5432 check port 8008
listen postgres_read
bind *:5001
balance roundrobin
option httpchk GET /replica
http-check expect status 200
default-server inter 3s fall 3 rise 2 on-marked-down shutdown-sessions
server pg-node1 pg-node1:5432 check port 8008
server pg-node2 pg-node2:5432 check port 8008
server pg-node3 pg-node3:5432 check port 8008