Skip to content

Instantly share code, notes, and snippets.

@toddlers
Last active October 10, 2017 07:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toddlers/bb768ac21a5c0148d74622e00d2ef97d to your computer and use it in GitHub Desktop.
Save toddlers/bb768ac21a5c0148d74622e00d2ef97d to your computer and use it in GitHub Desktop.
postgres_commands
# check master/slave status
# if f its master otherwise its slave
select pg_is_in_recovery();
#check lag status
SELECT EXTRACT(EPOCH FROM (now() - pg_last_xact_replay_timestamp()))::INT;
# check slave status
SELECT pg_last_xlog_receive_location();
# check activity status
select * from pg_stat_activity ;
# allow selected cidr in pg_hba
postgres=# show hba_file;
hba_file
---------------------------------------
/etc/postgresql/9.5/slave/pg_hba.conf
postgres=# SELECT pg_reload_conf();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment