From 8da05ad785da528b10d16cf8034a848b2e9c3948 Mon Sep 17 00:00:00 2001 From: Alexander Kukushkin Date: Thu, 25 Jan 2018 15:31:02 +0100 Subject: [PATCH] Update haproxy.tmpl (#614) connection to postgres should be closed forcibly when health-check fails --- extras/confd/templates/haproxy.tmpl | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/extras/confd/templates/haproxy.tmpl b/extras/confd/templates/haproxy.tmpl index 4309ed0c..752986f3 100644 --- a/extras/confd/templates/haproxy.tmpl +++ b/extras/confd/templates/haproxy.tmpl @@ -10,19 +10,23 @@ defaults timeout server 30m timeout check 5s -frontend master_postgresql +listen stats + mode http + bind *:7000 + stats enable + stats uri / + +listen master bind *:5000 - default_backend backend_master - -frontend replicas_postgresql - bind *:5001 - default_backend backend_replicas - -backend backend_master option httpchk OPTIONS /master + http-check expect status 200 + default-server inter 3s fall 3 rise 2 on-marked-down shutdown-sessions {{range gets "/members/*"}} server {{base .Key}} {{$data := json .Value}}{{base (replace (index (split $data.conn_url "/") 2) "@" "/" -1)}} maxconn 100 check port {{index (split (index (split $data.api_url "/") 2) ":") 1}} {{end}} -backend backend_replicas +listen replicas + bind *:5001 option httpchk OPTIONS /replica + http-check expect status 200 + default-server inter 3s fall 3 rise 2 on-marked-down shutdown-sessions {{range gets "/members/*"}} server {{base .Key}} {{$data := json .Value}}{{base (replace (index (split $data.conn_url "/") 2) "@" "/" -1)}} maxconn 100 check port {{index (split (index (split $data.api_url "/") 2) ":") 1}} {{end}}