Search Postgresql Archives

(replication) Detecting if server a slave, or a master in recovery

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
What is the correct way to tell what mode a replicated Pg server is currently in, via a database connection?

I can take a guess if it's the master or a slave by using the pg_current_xlog_location() and pg_last_xlog_replay_location() functions.

However it occurs to me that a master server, which has been roughly rebooted and is replaying its WAL files will probably give the same response as a slave, when I call the current_xlog_location().


What is the best method for determining whether you're connected to the master or slave database?


Thanks,
Toby

--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux