Last active
March 1, 2016 02:42
-
-
Save bryder/575e02cdc6c31c3a6d1a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
On the slave (python string) | |
"select pg_last_xlog_receive_location(), pg_last_xlog_replay_location(), " | |
"EXTRACT (EPOCH FROM now() - pg_last_xact_replay_timestamp()) AS seconds_since_last_replay, " | |
"pg_xlog_location_diff(pg_last_xlog_receive_location(), pg_last_xlog_replay_location()) " | |
"AS replay_receive_xlog_pos_delta; | |
On the master | |
use pg_xlog_location_diff with the extracted positions from the slave to do something similar | |
"select pg_current_xlog_location(), " | |
"pg_xlog_location_diff(pg_current_xlog_location(), '%s') AS slave_receive_xlog_pos_delta," | |
"pg_xlog_location_diff(pg_current_xlog_location(), '%s') AS slave_replay_xlog_pos_delta;" % | |
( raw_data['slave']['pg_last_xlog_receive_location'], | |
raw_data['slave']['pg_last_xlog_replay_location'], | |
) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment