Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hu4NU-0005Y0-JH for pgsql-admin@arkaria.postgresql.org; Sun, 04 Aug 2019 00:28:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hu4NR-0007av-RJ for pgsql-admin@arkaria.postgresql.org; Sun, 04 Aug 2019 00:27:57 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hu4NR-0007ao-Dt for pgsql-admin@lists.postgresql.org; Sun, 04 Aug 2019 00:27:57 +0000 Received: from mail-lj1-x22b.google.com ([2a00:1450:4864:20::22b]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hu4NJ-0002ds-Hk for pgsql-admin@postgresql.org; Sun, 04 Aug 2019 00:27:56 +0000 Received: by mail-lj1-x22b.google.com with SMTP id k18so76117457ljc.11 for ; Sat, 03 Aug 2019 17:27:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=puris-lv.20150623.gappssmtp.com; s=20150623; h=date:from:to:message-id:in-reply-to:references:subject:mime-version; bh=5aFyIW73A2P/wtF5BWdUL7Ob3oh3KtQnmf8ffY/HePw=; b=1ZBuv3ugKCDEU6EqvgOusDwIpdVdvASwEd8piQft/cj35LEUs407y1OfGT5vyAdU4e RK5y+pKj+sTldDt1jJ31UPVlybR2xkeXyQV3HFrcTUGK7X43vOGzp/R8pGOG0Cg/8V67 8nV4HSsfUzAt8ed39FqlqGYqxWGnLWXNgNbS2yS7U7+9iIEOtqrKOohP5GRCNgm4dwaC r/2SjQf5w/zd3AldRqP9DqD+aDzsK2p6LXOr55z2vt/GWu+4933bPLJKI3v6VzM1KyQm xmSEUFdIP0GMqMwajf08p1ImXyx025tSqPwln1pf+pH81iLfQKu0sXROV2hW2p98xIgc aZQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:message-id:in-reply-to:references :subject:mime-version; bh=5aFyIW73A2P/wtF5BWdUL7Ob3oh3KtQnmf8ffY/HePw=; b=YSxVggchia7mFJknYI4HbHIceMDnid5FBDG1UW55qZj9oEONDvwUVpLcwW+tIMRI4o 5gRFuEr+1ID8z+cIdsb04RWMcvmdHD8BrkzsW5TIssplVQXUyIqTWai3MOq3r8hwU+m+ blrmxpN1IFOWJuRGaYRzMgdk2bDmLdDgoBVBCip7YFNFWjzX9PluaMq9XywUZoDDL50N dxu0xcBy+hKqj2i8WzvedN3TVUZqHvP7hjELaS7kuuIh1yBqmnP3Wb1ATGu3/9EgVWyD GLD9kjWirlqGwqlRPw0Fnv7MN0f+u7Qq7nr9FntvczzFenZuwZUNodAbRzAPNvccnyiw 5rvQ== X-Gm-Message-State: APjAAAVZAT3Y/vVaO8c49NhxLYQv2rJNug3EeyvLrhya02CQ0DVSlAMm I2AF4xMZUC0tup0lCPnJFzFfQdhvDPI= X-Google-Smtp-Source: APXvYqw+NVXGYGQAzhlsXYeHdyyL68WLIWQcURfF1bdKoyX3d/FlFQgk/h8lDb+xZXtVqgBb/xziwQ== X-Received: by 2002:a2e:9b57:: with SMTP id o23mr4201523ljj.67.1564878465800; Sat, 03 Aug 2019 17:27:45 -0700 (PDT) Received: from [172.25.29.25] (vpn.netwerk.no. [193.58.241.100]) by smtp.gmail.com with ESMTPSA id l25sm15700455lja.76.2019.08.03.17.27.44 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 03 Aug 2019 17:27:45 -0700 (PDT) Date: Sun, 4 Aug 2019 02:27:39 +0200 From: =?utf-8?Q?J=C4=81nis_P=C5=ABris?= To: pgsql-admin@postgresql.org Message-ID: <6ae63a77-5f9c-4f57-b409-e79a8b0244fb@Spark> In-Reply-To: <5c247980-5a8f-4864-9e5a-3d330adcc253@Spark> References: <5c247980-5a8f-4864-9e5a-3d330adcc253@Spark> Subject: HAProxy + Patroni + pgBouncer High Availability setup X-Readdle-Message-ID: 6ae63a77-5f9c-4f57-b409-e79a8b0244fb@Spark MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="5d462680_749abb43_bb71" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --5d462680_749abb43_bb71 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hello, I have a working HAProxy, Patroni, PG stack and would like to add pgbounc= er in the mix. Current topology descr. Haproxy is checking Patroni API, if the node it is responsible for is pri= mary, if so, the requests are routed to it's postgresql server. When a fa= ilure occurs Patroni would do its magic and a different node in the clust= er is promoted, HAProxy sees it via Patroni API checks and requests are r= erouted to this new node. It works=21 The problem if I'd deploy pgBouncer between HAProxy and PostgreSQL, it would be a sin= gle point of failure. =46or example, if pgBouncer fails on primary, Patro= ni would not mind and no other node would take primary to mitigate the di= saster. Topology =5Bclient=5D <--> =5Bhaproxy=5D <---> =5Bpgbouncer=5D <---> =5Bpostgres=5D= =E2=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=83=7C= -----------> =5Bpatroni=5D <-------->/ How can I improve the architecture, to avoid single point of failure =3F = I could of course add watchdog and similar processes, but I would really = prefer not too overcomplicate the stack. P.S. Deploying pgBouncer before client app is not an option, as a lot of = different API and clients are talking to the cluster, as well as they are= deployed in range of environments, i.e. kubernetes, metal, vms etc and s= o on. Best regards, JP. --5d462680_749abb43_bb71 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
Hello,

I have a working HAProxy, Patroni, PG stack and wou= ld like to add pgbouncer in the mix.

Current topology descr.
Haproxy is checking Patroni API, if the node it is = responsible for is primary, if so, the requests are routed to it's postgr= esql server. When a failure occurs Patroni would do its magic and a diffe= rent node in the cluster is promoted, HAProxy sees it via Patroni API che= cks and requests are rerouted to this new node. It works=21

The problem
if I'd deploy pgBouncer between HAProxy and PostgreSQL, it would be a si= ngle point of failure. =46or example, if pgBouncer fails on primary, Patr= oni would not mind and no other node would take primary to mitigate the d= isaster.

Topology
=5Bclient=5D <--> =5Bhaproxy=5D <---> =5B= pgbouncer=5D <---> =5Bpostgres=5D
=E2=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=83=E2=80=83=7C= -----------> =5Bpatroni=5D <-------->/

How can I improve the architecture, to avoid single= point of failure =3F I could of course add watchdog and similar processe= s, but I would really prefer not too overcomplicate the stack.

P.S. Deploying pgBouncer before client app is not a= n option, as a lot of different API and clients are talking to the cluste= r, as well as they are deployed in range of environments, i.e. kubernetes= , metal, vms etc and so on.

Best regards, JP.
--5d462680_749abb43_bb71--