global
    daemon
    log stdout local0
    chroot /var/lib/haproxy
    stats socket /run/haproxy/admin.sock mode 660 level admin
    stats timeout 30s
    user haproxy
    group haproxy
defaults
    mode tcp
    log global
    option tcplog
    option dontlognull
    retries 3
    timeout queue 1m
    timeout connect 10s
    timeout client 1m
    timeout server 1m
    timeout check 10s
# Frontend - listens on port 5432
frontend postgres_frontend
    bind *:5432
    mode tcp
    default_backend postgres_backend
# Backend - forwards to your database server
backend postgres_backend
    mode tcp
    balance roundrobin
    option tcp-check
    tcp-check connect
    server db1 [DB IP/HOSTNAME]:5432 check