Re: How to find the primary server of a hot standby server?

From: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
To: Shoaib Mir <shoaibmir(at)gmail(dot)com>
Cc: Rudolf van der Leeden <vanderleeden(at)logicunited(dot)com>, pgsql-admin(at)postgresql(dot)org
Subject: Re: How to find the primary server of a hot standby server?
Date: 2010-10-15 06:27:08
Message-ID: 4CB7F43C.70303@lelarge.info
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Le 15/10/2010 00:53, Shoaib Mir a écrit :
> On Fri, Oct 15, 2010 at 9:39 AM, Guillaume Lelarge
> <guillaume(at)lelarge(dot)info>wrote:
>
>> Le 14/10/2010 23:18, Rudolf van der Leeden a écrit :
>>> [...]
>>> quick question to the PG 9 community.
>>>
>>> I can query a hot standby server if recovery is still active using
>>> the administration function pg_is_in_recovery(). Is there also a way
>>> to query for the 'primary server', i.e. which server is delivering
>>> the WAL records?
>>>
>>> I'd like to monitor a bunch of standby servers in terms of
>>> configuration and operation.
>>>
>>
>> There's no "SQL" way to know this, AFAICT. But I would love to be proven
>> wrong: I would be able to add this info to pgAdmin, which would be great.
>>
>>
>>
> What about doing a query like:
>
> show wal_level;
>
> If it shows *hot_standby* then that server should have been setup as master.
> As an extra step you can also check for archive_mode as well if its enabled
> or not.
>

It only helps you to know that the serveur you're currently connected to
is acting as a primary server. It doesn't tell you who the slaves are.
And it doesn't answer the OP's question which is, if I don't get it
wrong, "I'm connected to a slave, how do I know which master it works
with?".

--
Guillaume
http://www.postgresql.fr
http://dalibo.com

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Samuel Gendler 2010-10-15 08:12:54 Re: oracle to psql migration - slow query in postgres
Previous Message Mladen Gogala 2010-10-15 03:59:14 Re: oracle to psql migration - slow query in postgres