Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kD9o1-0002vO-Q1 for pgsql-general@arkaria.postgresql.org; Tue, 01 Sep 2020 17:10:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kD9o0-0001by-No for pgsql-general@arkaria.postgresql.org; Tue, 01 Sep 2020 17:10:48 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kD9o0-0001bk-Fu for pgsql-general@lists.postgresql.org; Tue, 01 Sep 2020 17:10:48 +0000 Received: from mail-lf1-x143.google.com ([2a00:1450:4864:20::143]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kD9ny-0001nH-En for pgsql-general@lists.postgresql.org; Tue, 01 Sep 2020 17:10:47 +0000 Received: by mail-lf1-x143.google.com with SMTP id y17so1202591lfa.8 for ; Tue, 01 Sep 2020 10:10:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=t9LXZl+Xb0WDB3CphE9iNLVihk4PTzA+mSQrKGe7LdY=; b=M6oSte0OW6h6ISo8224kq4M3g5WRzHo1PmVrOR6H2S7OGNRAHK+/AvjTYdZBsZTHB9 BTMoSkqV8tFKd2bSUV73giw09SUu6vREu7dS0lqpHzAv++hYovmUzBbvvGOIlztO4MqE WjRDvDbcJUUEqxr0b4cHGuH0WSw/4YfX6K/JB7JnsA3ZB2SQa4eXHA9OodMbSlskBKO8 PWMKvKDJYNYfHPXIKqTopq7b+l4Bwh8E4nljeQOy4VCy6/tS11lCSQHUupZS1ec6enp1 T66ao1vO4cXkG1yDMM2ftoSgszar281UAH/hk7rgvOXfsk1f38xJrPqkBh8A2ykYfuOA AeRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=t9LXZl+Xb0WDB3CphE9iNLVihk4PTzA+mSQrKGe7LdY=; b=Eqh0GxS/7JJ2876klHLPBuTSlp4agGVCjzvNq6JVvciQqwJwySh8PwcMXvLLHgCyrh lqW/llqBH5gm4VWRWgFaOo4tfqrLSSgdxsQ1DKTwCXHNfrMo6uEv3DV6q4RdTnuu6aV3 Dksqy+3yo2GC0cxMiJHBYQft6OyzrtqPae4AKMDrXat7yeYVe4DCJwM4aQ4bKM/f7RkF QF3T6Y0Nktt84n/CgtVquqoN/pEJaNCol6P8NMNlnM0VM3jFnc6zvuiBDYo68uuwJom3 gOXMt3ePyFNYEAndFX7j43c16qaOBODMSuCwJK7OpTN6/iaVJHinNP/+yuxcKV7UQMhX Xr5w== X-Gm-Message-State: AOAM532PBRFdN4G/YHxY+Tjpb5und38nyejBY5/XHbyw2RX+gqjm6DFe LZZtEsN1Z8bd5/CRzVaTOaHQlYmt97h6HA== X-Google-Smtp-Source: ABdhPJxePI5iFCEYDDvhD7lpLR6K5qihNunIoWNx3e3zhMQb4jtnUaonK27mUWRRRsXwrVrmECcp0g== X-Received: by 2002:a19:4094:: with SMTP id n142mr1112853lfa.166.1598980244481; Tue, 01 Sep 2020 10:10:44 -0700 (PDT) Received: from [192.168.43.224] ([176.59.116.119]) by smtp.gmail.com with ESMTPSA id l16sm396278lje.90.2020.09.01.10.10.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 01 Sep 2020 10:10:44 -0700 (PDT) Subject: Re: High Availability, guarantee to use sync nodes To: Dirk Krautschick , "pgsql-general@lists.postgresql.org" References: From: Maksim Milyutin Message-ID: <211b2c1e-8cdc-0ba7-fd8d-c8e13c3685a6@gmail.com> Date: Tue, 1 Sep 2020 20:10:41 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------F28B5DE6B127400D7304D0B0" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------F28B5DE6B127400D7304D0B0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit On 31.08.2020 14:06, Dirk Krautschick wrote: > Hi all, > Hi > if there are several PostgreSQL nodes replicating synchronous and I > configure a guarantee that > > for example 3 of 5 nodes have to be in sync to go on with > synchronous_standby_names and > > now I want to implement a load balancing scenario with active standby > DBs…how or with what > > tool can I achieve that my read clients only use sync nodes. For sure > somehow a check in the > > pg_stat_replication before is possible but is there something in > parameters or with solutions > > like repmgr, patroni, etc. to do this? > For such tools as patroni or stolon the list of sync replicas could be got from DCS storage (etcd, consul, etc). Your application or some proxy, e.g. haproxy with confd, might extract the list of sync nodes, subscribe on changes in KV entry that stores this list and routes queries according it. -- Regards, Maksim Milyutin --------------F28B5DE6B127400D7304D0B0 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: 8bit

On 31.08.2020 14:06, Dirk Krautschick wrote:

Hi all,


Hi

 

if there are several PostgreSQL nodes replicating synchronous and I configure a guarantee that

for example 3 of 5 nodes have to be in sync to go on with synchronous_standby_names and

now I want to implement a load balancing scenario with active standby DBs…how or with what

tool can I achieve that my read clients only use sync nodes. For sure somehow a check in the

pg_stat_replication before is possible but is there something in parameters or with solutions

like repmgr, patroni, etc. to do this?


For such tools as patroni or stolon the list of sync replicas could be got from DCS storage (etcd, consul, etc). Your application or some proxy, e.g. haproxy with confd, might extract the list of sync nodes, subscribe on changes in KV entry that stores this list and routes queries according it.


-- 
Regards,
Maksim Milyutin
--------------F28B5DE6B127400D7304D0B0--