View monitoring_replication
Replication monitoring of primaries and followers. Columns with names starting with standby_ are important to monitor followers.
Monitoring itself is done on the current primary.
Columns
| Column Name | Description |
|---|---|
| pid | The process id of the WAL sender process. |
| oid_user | The OID of the user logged into this WAL sender process. |
| user_name | The name of user the logged into this WAL sender process. |
| application_name | The name of the application that is connected to this WAL sender. |
| client_addr | The IP address of the client connected to this WAL sender. If this field is null, it indicates that the client is connected via a Unix socket on the server machine. |
| client_hostname | The host name of the connected client, as reported by a reverse DNS lookup of client_addr. This field will only be non-null for IP connections, and only when log_hostname is enabled. |
| client_port | The TCP port number that the client is using for communication with this WAL sender, or -1 if a Unix socket is used. |
| backend_start | The time when this process was started, i.e., when the client connected to this WAL sender. |
| backend_xmin | This standby’s xmin horizon reported by hot_standby_feedback. |
| state | The current WAL sender state. Possible values are: startup: This WAL sender is starting up. catchup: This WAL sender’s connected standby is catching up with the primary. streaming: This WAL sender is streaming changes after its connected standby server has caught up with the primary. backup: This WAL sender is sending a backup. stopping: This WAL sender is stopping. |
| last_wal_sent | The last write-ahead log location sent on this connection. |
| standby_lastwal_written | |
| standby_last_wal_replayed | The last write-ahead log location replayed into the database on this standby server |
| standby_last_wal_flushed | |
| standby_wal_write_lag | |
| standby_flush_lag | |
| standby_wal_replay_lag | The last write-ahead log location replayed into the database on this standby server. |
| standby_sync_priority | The priority of this standby server for being chosen as the synchronous standby in a priority-based synchronous replication. This has no effect in a quorum-based synchronous replication. |
| standby_sync_state | Synchronous state of this standby server. Possible values are: async: This standby server is asynchronous. potential: This standby server is now asynchronous, but can potentially become synchronous if one of current synchronous ones fails. sync: This standby server is synchronous. quorum: This standby server is considered as a candidate for quorum standbys. |
| last_replay_message_from_standby | The send time of last reply message received from this standby server |
Example
SELECT *
FROM monitoring_wal;