PostgreSQL – 2 Simple ways to tell if you are on a streaming replica or a master db?

  1. Issue the pg_lscluster command against the cluster of concern, if it is a replica and not a master, under “status” you will see it with value of “online, recovery”. If it is writeable master db in a streaming replication set up however, it will not include the word “recovery”.
  2. From the psql client you can also issue the command: select pg_is_in_recovery(); and if it is a replica, it will say “T” or true.

1 thought on “PostgreSQL – 2 Simple ways to tell if you are on a streaming replica or a master db?”

Leave a Reply

Your email address will not be published. Required fields are marked *