Search Postgresql Archives

Script to check replication

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

 



Hi,

 

We are running Streaming replication with Hot standby in our current production. I do have below script to check replication status and replication lag. Does anyone have script which runs every 15 mins to check replication status and send out email if replication is not running or lagging behind.

 

SELECT pg_last_xlog_receive_location() receive, pg_last_xlog_replay_location() replay, now() - pg_last_xact_replay_timestamp() AS replication_delay, (extract(epoch FROM now()) -   extract(epoch FROM pg_last_xact_replay_timestamp()))::int lag

 

Thanks for your help!

 

Thanks,

Ashish Chauhan

 


[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