Thread: Check server mode (standby / master)

Check server mode (standby / master)

From
Alexander Perepelica
Date:
Hello!

How can I check which mode has a sever: master or slave (standby) after I setup replication?

Thank you!
Alex

Re: Check server mode (standby / master)

From
raghu ram
Date:


On Tue, Aug 16, 2011 at 1:16 PM, Alexander Perepelica <perepelica.alex@gmail.com> wrote:
Hello!

How can I check which mode has a sever: master or slave (standby) after I setup replication?


You can check the mode of the server using "pg_controldata".

[pgsql@test~]$ pg_controldata /usr/local/pgsql/data84/

Database cluster state:               in archive recovery   --> This is Standby  Database

Database cluster state:               in production  --> This is Production Database [Master]

--Raghu Ram

 

Re: Check server mode (standby / master)

From
Simon Riggs
Date:
On Tue, Aug 16, 2011 at 8:46 AM, Alexander Perepelica
<perepelica.alex@gmail.com> wrote:

> How can I check which mode has a sever: master or slave (standby) after I
> setup replication?

You can run the query pg_is_in_recovery(), available since 9.0
http://developer.postgresql.org/pgdocs/postgres/functions-admin.html#FUNCTIONS-RECOVERY-INFO-TABLE

--
 Simon Riggs                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services