From: | Guillaume Lelarge <guillaume(at)lelarge(dot)info> |
---|---|
To: | Toby Corkindale <toby(dot)corkindale(at)strategicdata(dot)com(dot)au> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: (replication) Detecting if server a slave, or a master in recovery |
Date: | 2011-09-12 08:26:22 |
Message-ID: | 1315815982.2708.7.camel@localhost.localdomain |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Mon, 2011-09-12 at 17:09 +1000, Toby Corkindale wrote:
> On 12/09/11 16:54, Toby Corkindale wrote:
> > Hi,
> > What is the correct way to tell what mode a replicated Pg server is
> > currently in, via a database connection?
> >
> > I can take a guess if it's the master or a slave by using the
> > pg_current_xlog_location() and pg_last_xlog_replay_location() functions.
> >
> > However it occurs to me that a master server, which has been roughly
> > rebooted and is replaying its WAL files will probably give the same
> > response as a slave, when I call the current_xlog_location().
> >
> >
> > What is the best method for determining whether you're connected to the
> > master or slave database?
>
>
> It's disappointing that I can't query standby_mode in psql.
> ie.
> SHOW standby_mode;
>
I agree. Actually, you can't get the value of any parameter set in
recovery.conf. But Fuji Masao seems to work on it: he posted a patch to
unite recovery.conf and postgresql.conf (see "unite recovery.conf and
postgresql.conf" thread on pgsql-hackers). And I guess it'll help us
querying these parameters' values.
--
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com
From | Date | Subject | |
---|---|---|---|
Next Message | Magnus Hagander | 2011-09-12 08:31:07 | Re: Has Pg 9.1.0 been released today? |
Previous Message | Toby Corkindale | 2011-09-12 08:10:55 | Has Pg 9.1.0 been released today? |