Postgresql

檢查主伺服器是否從從伺服器(複製)postgresql

  • September 27, 2018

我想通過從伺服器查詢來檢查我的主伺服器是否已啟動?有什麼意見或命令嗎?

我想把它寫成評論,但我沒有足夠的聲譽。你試過pg_stat_wal_receiver嗎?它與 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

引用自:https://dba.stackexchange.com/questions/218714