Difference between revisions of "Monitor PostgreSQL Replication"
Jump to navigation
Jump to search
(Created page with "'''Find Out Which is Master or Slave''' # select pg_is_in_recovery() If it's true, we're on a slave; if false, master. '''List All Databases''' # \l '''Check Synchron...") |
|||
Line 15: | Line 15: | ||
postgres@dbmaster:~$ psql -x -c "select * from pg_stat_replication;" | postgres@dbmaster:~$ psql -x -c "select * from pg_stat_replication;" | ||
− | This must be run in master db node. Or we can check the sync status only like below. | + | This must be run in master db node. |
+ | <br>Or we can check the sync status only like below. | ||
# select sync_state from pg_stat_replication; | # select sync_state from pg_stat_replication; |
Latest revision as of 14:41, 27 October 2020
Find Out Which is Master or Slave
# select pg_is_in_recovery()
If it's true, we're on a slave; if false, master.
List All Databases
# \l
Check Synchronization Status
postgres@dbmaster:~$ psql -x -c "select * from pg_stat_replication;"
This must be run in master db node.
Or we can check the sync status only like below.
# select sync_state from pg_stat_replication;
Possible values of sync_state are:
async: This standby server is asynchronous -> CRITICAL! potential: This standby server is asynchronous, but can potentially become synchronous if one of current synchronous ones fails -> WARNING sync: This standby server is synchronous -> OK quorum: This standby server is considered as a candidate for quorum standbys -> OK