Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 9728E1337990 for ; Fri, 15 Oct 2010 03:27:17 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 47762-04 for ; Fri, 15 Oct 2010 06:27:10 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sd-17937.dedibox.fr (sd-17937.dedibox.fr [88.191.100.74]) by mail.postgresql.org (Postfix) with ESMTP id B4F971336705 for ; Fri, 15 Oct 2010 03:27:09 -0300 (ADT) Received: from [192.168.42.162] (LCaen-151-93-7-26.w80-13.abo.wanadoo.fr [80.13.230.26]) by sd-17937.dedibox.fr (Postfix) with ESMTPA id C9DE33B8F5; Fri, 15 Oct 2010 08:27:08 +0200 (CEST) Message-ID: <4CB7F43C.70303@lelarge.info> Date: Fri, 15 Oct 2010 08:27:08 +0200 From: Guillaume Lelarge User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); fr; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4 MIME-Version: 1.0 To: Shoaib Mir CC: Rudolf van der Leeden , pgsql-admin@postgresql.org Subject: Re: How to find the primary server of a hot standby server? References: <0F09A748-DB17-44B3-BCE0-2FEAA22E8FE5@logicunited.com> <4CB786B7.7080700@lelarge.info> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.324 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_NJABL_PROXY=2.224 X-Spam-Level: X-Archive-Number: 201010/127 X-Sequence-Number: 35868 Le 15/10/2010 00:53, Shoaib Mir a écrit : > On Fri, Oct 15, 2010 at 9:39 AM, Guillaume Lelarge > 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