Re: Pg_ctl promote -- wait for slave to be promoted fully ?

From: Chris Angelico <rosuav(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Pg_ctl promote -- wait for slave to be promoted fully ?
Date: 2012-07-21 01:57:43
Message-ID: CAPTjJmo7DZ3AbHn0iDbRxSUn6zcmENriBra0ynhyp5VvCmtugw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Sat, Jul 21, 2012 at 5:28 AM, Manoj Govindassamy
<manoj(at)nimblestorage(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message imagenesis@gmail.com 2012-07-21 04:42:46 search_path reset on error (making it not reset)
Previous Message Chris Angelico 2012-07-21 01:55:04 Re: Select Rows With Only One of Two Values

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2012-07-21 04:20:57 Re: CHECK NO INHERIT syntax
Previous Message Daniele Varrazzo 2012-07-21 00:08:58 Resetting libpq connections after an app error