how to tell master from replica

From: Scott Ribe <scott_ribe(at)elevated-dev(dot)com>
To: Postgresql General <pgsql-general(at)postgresql(dot)org>
Subject: how to tell master from replica
Date: 2013-09-25 23:53:42
Message-ID: E7B9EDC6-7233-438D-9F71-14CFFECCF9E5@elevated-dev.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 could executed against sys tables to find current running config of the local postmaster?

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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message bricklen 2013-09-26 00:11:14 Re: how to tell master from replica
Previous Message Lonni J Friedman 2013-09-25 21:55:42 Re: postgres FDW doesn't support sequences?