Re: Notify When Streaming Replication Failover Occurred (slave promoted to master).

Поиск
Список
Период
Сортировка
От Peter J. Holzer
Тема Re: Notify When Streaming Replication Failover Occurred (slave promoted to master).
Дата
Msg-id 20210613155121.GA15132@hjp.at
обсуждение исходный текст
Ответ на Notify When Streaming Replication Failover Occurred (slave promoted to master).  (Avi Weinberg <AviW@gilat.com>)
Список pgsql-general
On 2021-06-13 08:00:24 +0000, Avi Weinberg wrote:
> I need to take actions when Postgres streaming replication failover occurred.
> Is there a way to be notified when Postgres slave becomes master?  If no such
> notification possible, what is the best way to actively monitor which server is
> master.  My Postgres  is running inside Kubernetes and the HA is managed by
> Patroni.

I just do
    patronictl list -f yaml | grep -v 'Lag in MB'
periodically and send an email if the output changes. Of course instead
of sending an email the script could take any other action.

        hp

--
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | hjp@hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"

Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: Avi Weinberg
Дата:
Сообщение: Notify When Streaming Replication Failover Occurred (slave promoted to master).
Следующее
От: "Avi Weinberg"
Дата:
Сообщение: Notify When Streaming Replication Failover Occurred (slave promoted to master).