how to tell master from replica - Mailing list pgsql-general

From Scott Ribe
Subject how to tell master from replica
Date
Msg-id E7B9EDC6-7233-438D-9F71-14CFFECCF9E5@elevated-dev.com
Whole thread Raw
Responses Re: how to tell master from replica  (bricklen <bricklen@gmail.com>)
Re: how to tell master from replica  (Michael Paquier <michael.paquier@gmail.com>)
List pgsql-general
Assuming a master & replica set up using streaming replication, hot standby, 9.3.

I'd like to have a single script on both machines distinguish whether it's running on the machine with the master or
replica,and take different actions accordingly. 

Is the way to do this to check for the presence of wal sender process vs wal receiver process? Or is there a query that
couldexecuted against sys tables to find current running config of the local postmaster? 

--
Scott Ribe
scott_ribe@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice






pgsql-general by date:

Previous
From: Lonni J Friedman
Date:
Subject: Re: postgres FDW doesn't support sequences?
Next
From: bricklen
Date:
Subject: Re: how to tell master from replica