##
##  cockroach-haproxy.cfg -- HAProxy server configuration for Consul-managed CockroachDB cluster
##

global
    daemon
    log                   127.0.0.1 local0 notice
    user                  @l_nusr@
    group                 @l_ngrp@
    maxconn               4096

defaults
    log                   global
    mode                  tcp
    option                httplog
    option                dontlognull
    retries               3
    redispatch
    maxconn               2000
    timeout connect       5s
    timeout client        60s
    timeout server        60s

listen cockroach 127.0.0.1:26257
    mode                  tcp
    balance               roundrobin
    server-template       {{$servicename}} {{keyOrDefault $nbsrvkeyname "10"}} _{{$servicename}}._tcp.service.consul resolvers consul resolve-prefer ipv4 check inter 2000 rise 2 fall 5
    timeout server        20s

resolvers consul
    nameserver            ns 127.0.0.1:8600
    accepted_payload_size 8192

