Re: Pg_ctl promote -- wait for slave to be promoted fully ? - Mailing list pgsql-general

From Chris Angelico
Subject Re: Pg_ctl promote -- wait for slave to be promoted fully ?
Date
Msg-id CAPTjJmo7DZ3AbHn0iDbRxSUn6zcmENriBra0ynhyp5VvCmtugw@mail.gmail.com
Whole thread Raw
In response to Pg_ctl promote -- wait for slave to be promoted fully ?  (Manoj Govindassamy <manoj@nimblestorage.com>)
Responses Re: Pg_ctl promote -- wait for slave to be promoted fully ?
List pgsql-general
On Sat, Jul 21, 2012 at 5:28 AM, Manoj Govindassamy
<manoj@nimblestorage.com> wrote:
> -- Anyway I can query the state of DB to know its status slave or master ??
> So, that i can issue write statements only after I know that the DB is the
> new master now

Yep. Use pg_is_in_recovery() - it's false on the master, true on slaves.

http://www.postgresql.org/docs/9.1/static/functions-admin.html#FUNCTIONS-RECOVERY-INFO-TABLE

ChrisA

pgsql-general by date:

Previous
From: Chris Angelico
Date:
Subject: Re: Select Rows With Only One of Two Values
Next
From: Benjamin Adams
Date:
Subject: Get DB Size by row