0

I want to check whether my master server is up by querying from slave server ? Is there any view or command ?

1

I wanted to write this as comment but I don't have enough reputation. Did you tried, pg_stat_wal_receiver? It came with PostgreSQL-9.6.

dbs=# select * from pg_stat_wal_receiver ;
-[ RECORD 1 ]---------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
pid                   | 12345
status                | streaming
receive_start_lsn     | B0/F0000000
receive_start_tli     | 1
received_lsn          | CE/13C7B18
received_tli          | 1
last_msg_send_time    | 2018-09-26 16:15:25
last_msg_receipt_time | 2018-09-26 16:15:25
latest_end_lsn        | CE/13C7B18
latest_end_time       | 2018-09-26 16:15:25
slot_name             | 
conninfo              | connection info

https://www.postgresql.org/docs/9.6/static/monitoring-stats.html#PG-STAT-WAL-RECEIVER-VIEW

  • Thank you.Its helpful :).I have stopped my master server and run this query in slave server,it returned 0 records. – vyshu Ysh Sep 28 '18 at 6:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.