From: Peter J. Holzer <hjp-pgsql@hjp.at>
To: pgsql-general@lists.postgresql.org
Subject: Re: Notify When Streaming Replication Failover Occurred (slave promoted to master).
Date: Wed, 16 Jun 2021 10:08:02 +0200
Message-ID: <20210616080802.GA26107@hjp.at> (raw)
In-Reply-To: <CADK3HHKVjhHbw-EBYG6nAQzDqMwb0etKRXPCFmbuiiVqFDD83A@mail.gmail.com>
References: <000001d760ac$38ea9ca0$aabfd5e0$@gilat.com>
<CADK3HHKVjhHbw-EBYG6nAQzDqMwb0etKRXPCFmbuiiVqFDD83A@mail.gmail.com>
On 2021-06-14 08:10:58 -0400, Dave Cramer wrote:
> On Sun, 13 Jun 2021 at 19:32, Avi Weinberg <AviW@gilat.com> wrote:
>
>
> I need to take actions when Postgres streaming replication failover
> occurred. Is there a way to be notified when Postgres slave becomes
> master?
>
> On the surface this seems like a great idea, however contemplating this a bit
> more; where would the signal come from ? Currently the only option I can think
> of is to send a NOTIFY.
> It seems to me that the Patroni code is a better place to do this from.
I agree. That is something Patroni should do, not the database. Maybe
Patroni could be extended to invoke a script after taking some action.
I know of one program (vip_manager) which monitors patroni state and
takes action (enable/disable virtual ip addresses) - that one checks the
distributed database (etcd or whatever) periodically, AFAIK.
hp
--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | hjp@hjp.at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"
Attachments:
signature.asc (application/pgp-signature, 832B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: hjp-pgsql@hjp.at
Subject: Re: Notify When Streaming Replication Failover Occurred (slave promoted to master).
In-Reply-To: <20210616080802.GA26107@hjp.at>
References: <000001d760ac$38ea9ca0$aabfd5e0$@gilat.com> <CADK3HHKVjhHbw-EBYG6nAQzDqMwb0etKRXPCFmbuiiVqFDD83A@mail.gmail.com> <20210616080802.GA26107@hjp.at>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox