Re: Determine if postgresql cluster running is primary or not

2020-11-20 Thread David G. Johnston
On Friday, November 20, 2020, Paul Förster wrote: > Hi David, > > > On 20. Nov, 2020, at 10:34, David G. Johnston < > david.g.johns...@gmail.com> wrote: > > > > > > On Friday, November 20, 2020, Paul Förster > wrote: > > > > > On 20. Nov, 2020, at 10:03, Thomas Kellerer wrote: > > > > > > > >

Re: Determine if postgresql cluster running is primary or not

2020-11-20 Thread Raul Kaubi
Ok, Thanks! Raul Kontakt Paul Förster () kirjutas kuupäeval R, 20. november 2020 kell 12:54: > Hi Raul, > > > On 20. Nov, 2020, at 11:45, Raul Kaubi wrote: > > > > Hmm, ok. > > > > But how is this possible..? > > > > when b.sender>0 and c.receiver>0 then > > 'Primary+Replica' > > >

Re: Determine if postgresql cluster running is primary or not

2020-11-20 Thread Paul Förster
Hi Raul, > On 20. Nov, 2020, at 11:45, Raul Kaubi wrote: > > Hmm, ok. > > But how is this possible..? > > when b.sender>0 and c.receiver>0 then > 'Primary+Replica' > > Raul this happens for example if you have a primary a and replica b running as a normal cluster (we use Patron

Re: Determine if postgresql cluster running is primary or not

2020-11-20 Thread Raul Kaubi
Hmm, ok. But how is this possible..? when b.sender>0 and c.receiver>0 then > 'Primary+Replica' Raul Kontakt Paul Förster () kirjutas kuupäeval R, 20. november 2020 kell 12:04: > Hi Raul, > > > On 20. Nov, 2020, at 10:41, Raul Kaubi wrote: > > > > Hi > > > > Thanks. > > Seems lik

Re: Determine if postgresql cluster running is primary or not

2020-11-20 Thread Paul Förster
Hi Raul, > On 20. Nov, 2020, at 10:41, Raul Kaubi wrote: > > Hi > > Thanks. > Seems like 9.5 does not work. > > ERROR: relation "pg_stat_wal_receiver" does not exist > LINE 20: from pg_stat_wal_receiver > > Any ide how to achieve this in 9.5 ? > > Raul this query is tested to work

Re: Determine if postgresql cluster running is primary or not

2020-11-20 Thread Paul Förster
Hi David, > On 20. Nov, 2020, at 10:34, David G. Johnston > wrote: > > > On Friday, November 20, 2020, Paul Förster wrote: > > > On 20. Nov, 2020, at 10:03, Thomas Kellerer wrote: > > > > > select pg_is_in_recovery(); > > I usually don't recommend using pg_is_in_recovery() only because

Re: Determine if postgresql cluster running is primary or not

2020-11-20 Thread Raul Kaubi
Hi Thanks. Seems like 9.5 does not work. ERROR: relation "pg_stat_wal_receiver" does not exist > LINE 20: from pg_stat_wal_receiver Any ide how to achieve this in 9.5 ? Raul Kontakt Paul Förster () kirjutas kuupäeval R, 20. november 2020 kell 11:29: > Hi Thomas, > > > On 20. Nov, 20

Re: Determine if postgresql cluster running is primary or not

2020-11-20 Thread David G. Johnston
On Friday, November 20, 2020, Paul Förster wrote: > > > > On 20. Nov, 2020, at 10:03, Thomas Kellerer wrote: > > > > > select pg_is_in_recovery(); > > I usually don't recommend using pg_is_in_recovery() only because a > database cluster can be in recovery for other reasons. This is why I always

Re: Determine if postgresql cluster running is primary or not

2020-11-20 Thread Paul Förster
Hi Thomas, > On 20. Nov, 2020, at 10:03, Thomas Kellerer wrote: > > 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 p

Re: Determine if postgresql cluster running is primary or not

2020-11-20 Thread Thomas Kellerer
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 b

Determine if postgresql cluster running is primary or not

2020-11-20 Thread Raul Kaubi
Hi 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. What would be the best way to achieve this? Regards Raul