Re: Determine if postgresql cluster running is primary or not

From: Thomas Kellerer <shammat(at)gmx(dot)net>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Determine if postgresql cluster running is primary or not
Date: 2020-11-20 09:03:21
Message-ID: f09b2f94-d9a5-473c-d726-7e1aa53a7e94@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Raul Kaubi schrieb am 20.11.2020 um 09:53:
> CentOS 7
> Postgres 9 to 12
>
> For monitoring purpose, I would like that certain scripts are only run in primary server.
> So I am looking ways to universally discover if postgresql cluster that is running is primary or not.

As the standby will be in constant recovery, you can use

select pg_is_in_recovery();

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Paul Förster 2020-11-20 09:28:55 Re: Determine if postgresql cluster running is primary or not
Previous Message Raul Kaubi 2020-11-20 08:53:47 Determine if postgresql cluster running is primary or not