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

From bricklen
Subject Re: how to tell master from replica
Date
Msg-id CAGrpgQ8THuYjjv4Z_1cU9fRkGOiTzJiUoKK=zUTKysHp=cwvBA@mail.gmail.com
Whole thread Raw
In response to how to tell master from replica  (Scott Ribe <scott_ribe@elevated-dev.com>)
Responses Re: how to tell master from replica  (bricklen <bricklen@gmail.com>)
List pgsql-general

On Wed, Sep 25, 2013 at 4:53 PM, Scott Ribe <scott_ribe@elevated-dev.com> wrote:
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?


pgsql-general by date:

Previous
From: Scott Ribe
Date:
Subject: how to tell master from replica
Next
From: Michael Paquier
Date:
Subject: Re: how to tell master from replica