pg_stat_wal_receiver

一个统计视图,显示有关服务器 WAL 接收器的信息

pg_stat_wal_receiver 是一个 统计视图,显示有关服务器 WAL 接收器的信息(如果正在运行)。

pg_stat_wal_receiverPostgreSQL 9.6 中引入。

源代码

pg_stat_wal_receiver 基于内部系统函数 pg_stat_get_wal_receiver(),定义在 src/backend/replication/walreceiver.c 中。

按 PostgreSQL 版本定义

pg_stat_wal_receiver (PostgreSQL 17)

                      View "pg_catalog.pg_stat_wal_receiver"
        Column         |           Type           | Collation | Nullable | Default 
-----------------------+--------------------------+-----------+----------+---------
 pid                   | integer                  |           |          | 
 status                | text                     |           |          | 
 receive_start_lsn     | pg_lsn                   |           |          | 
 receive_start_tli     | integer                  |           |          | 
 written_lsn           | pg_lsn                   |           |          | 
 flushed_lsn           | pg_lsn                   |           |          | 
 received_tli          | integer                  |           |          | 
 last_msg_send_time    | timestamp with time zone |           |          | 
 last_msg_receipt_time | timestamp with time zone |           |          | 
 latest_end_lsn        | pg_lsn                   |           |          | 
 latest_end_time       | timestamp with time zone |           |          | 
 slot_name             | text                     |           |          | 
 sender_host           | text                     |           |          | 
 sender_port           | integer                  |           |          | 
 conninfo              | text                     |           |          |
    

文档: pg_stat_wal_receiver

pg_stat_wal_receiver (PostgreSQL 16)

                      View "pg_catalog.pg_stat_wal_receiver"
        Column         |           Type           | Collation | Nullable | Default 
-----------------------+--------------------------+-----------+----------+---------
 pid                   | integer                  |           |          | 
 status                | text                     |           |          | 
 receive_start_lsn     | pg_lsn                   |           |          | 
 receive_start_tli     | integer                  |           |          | 
 written_lsn           | pg_lsn                   |           |          | 
 flushed_lsn           | pg_lsn                   |           |          | 
 received_tli          | integer                  |           |          | 
 last_msg_send_time    | timestamp with time zone |           |          | 
 last_msg_receipt_time | timestamp with time zone |           |          | 
 latest_end_lsn        | pg_lsn                   |           |          | 
 latest_end_time       | timestamp with time zone |           |          | 
 slot_name             | text                     |           |          | 
 sender_host           | text                     |           |          | 
 sender_port           | integer                  |           |          | 
 conninfo              | text                     |           |          |
    

文档: pg_stat_wal_receiver

pg_stat_wal_receiver (PostgreSQL 15)

                      View "pg_catalog.pg_stat_wal_receiver"
        Column         |           Type           | Collation | Nullable | Default 
-----------------------+--------------------------+-----------+----------+---------
 pid                   | integer                  |           |          | 
 status                | text                     |           |          | 
 receive_start_lsn     | pg_lsn                   |           |          | 
 receive_start_tli     | integer                  |           |          | 
 written_lsn           | pg_lsn                   |           |          | 
 flushed_lsn           | pg_lsn                   |           |          | 
 received_tli          | integer                  |           |          | 
 last_msg_send_time    | timestamp with time zone |           |          | 
 last_msg_receipt_time | timestamp with time zone |           |          | 
 latest_end_lsn        | pg_lsn                   |           |          | 
 latest_end_time       | timestamp with time zone |           |          | 
 slot_name             | text                     |           |          | 
 sender_host           | text                     |           |          | 
 sender_port           | integer                  |           |          | 
 conninfo              | text                     |           |          |
    

文档: pg_stat_wal_receiver

pg_stat_wal_receiver (PostgreSQL 14)

                      View "pg_catalog.pg_stat_wal_receiver"
        Column         |           Type           | Collation | Nullable | Default 
-----------------------+--------------------------+-----------+----------+---------
 pid                   | integer                  |           |          | 
 status                | text                     |           |          | 
 receive_start_lsn     | pg_lsn                   |           |          | 
 receive_start_tli     | integer                  |           |          | 
 written_lsn           | pg_lsn                   |           |          | 
 flushed_lsn           | pg_lsn                   |           |          | 
 received_tli          | integer                  |           |          | 
 last_msg_send_time    | timestamp with time zone |           |          | 
 last_msg_receipt_time | timestamp with time zone |           |          | 
 latest_end_lsn        | pg_lsn                   |           |          | 
 latest_end_time       | timestamp with time zone |           |          | 
 slot_name             | text                     |           |          | 
 sender_host           | text                     |           |          | 
 sender_port           | integer                  |           |          | 
 conninfo              | text                     |           |          |
    

文档: pg_stat_wal_receiver

pg_stat_wal_receiver (PostgreSQL 13)

                      View "pg_catalog.pg_stat_wal_receiver"
        Column         |           Type           | Collation | Nullable | Default 
-----------------------+--------------------------+-----------+----------+---------
 pid                   | integer                  |           |          | 
 status                | text                     |           |          | 
 receive_start_lsn     | pg_lsn                   |           |          | 
 receive_start_tli     | integer                  |           |          | 
 written_lsn           | pg_lsn                   |           |          | 
 flushed_lsn           | pg_lsn                   |           |          | 
 received_tli          | integer                  |           |          | 
 last_msg_send_time    | timestamp with time zone |           |          | 
 last_msg_receipt_time | timestamp with time zone |           |          | 
 latest_end_lsn        | pg_lsn                   |           |          | 
 latest_end_time       | timestamp with time zone |           |          | 
 slot_name             | text                     |           |          | 
 sender_host           | text                     |           |          | 
 sender_port           | integer                  |           |          | 
 conninfo              | text                     |           |          |
    

文档: pg_stat_wal_receiver

pg_stat_wal_receiver (PostgreSQL 12)

                      View "pg_catalog.pg_stat_wal_receiver"
        Column         |           Type           | Collation | Nullable | Default 
-----------------------+--------------------------+-----------+----------+---------
 pid                   | integer                  |           |          | 
 status                | text                     |           |          | 
 receive_start_lsn     | pg_lsn                   |           |          | 
 receive_start_tli     | integer                  |           |          | 
 received_lsn          | pg_lsn                   |           |          | 
 received_tli          | integer                  |           |          | 
 last_msg_send_time    | timestamp with time zone |           |          | 
 last_msg_receipt_time | timestamp with time zone |           |          | 
 latest_end_lsn        | pg_lsn                   |           |          | 
 latest_end_time       | timestamp with time zone |           |          | 
 slot_name             | text                     |           |          | 
 sender_host           | text                     |           |          | 
 sender_port           | integer                  |           |          | 
 conninfo              | text                     |           |          |
    

文档: pg_stat_wal_receiver

pg_stat_wal_receiver (PostgreSQL 11)

                      View "pg_catalog.pg_stat_wal_receiver"
        Column         |           Type           | Collation | Nullable | Default 
-----------------------+--------------------------+-----------+----------+---------
 pid                   | integer                  |           |          | 
 status                | text                     |           |          | 
 receive_start_lsn     | pg_lsn                   |           |          | 
 receive_start_tli     | integer                  |           |          | 
 received_lsn          | pg_lsn                   |           |          | 
 received_tli          | integer                  |           |          | 
 last_msg_send_time    | timestamp with time zone |           |          | 
 last_msg_receipt_time | timestamp with time zone |           |          | 
 latest_end_lsn        | pg_lsn                   |           |          | 
 latest_end_time       | timestamp with time zone |           |          | 
 slot_name             | text                     |           |          | 
 sender_host           | text                     |           |          | 
 sender_port           | integer                  |           |          | 
 conninfo              | text                     |           |          |
    

文档: pg_stat_wal_receiver

pg_stat_wal_receiver (PostgreSQL 10)

                      View "pg_catalog.pg_stat_wal_receiver"
        Column         |           Type           | Collation | Nullable | Default 
-----------------------+--------------------------+-----------+----------+---------
 pid                   | integer                  |           |          | 
 status                | text                     |           |          | 
 receive_start_lsn     | pg_lsn                   |           |          | 
 receive_start_tli     | integer                  |           |          | 
 received_lsn          | pg_lsn                   |           |          | 
 received_tli          | integer                  |           |          | 
 last_msg_send_time    | timestamp with time zone |           |          | 
 last_msg_receipt_time | timestamp with time zone |           |          | 
 latest_end_lsn        | pg_lsn                   |           |          | 
 latest_end_time       | timestamp with time zone |           |          | 
 slot_name             | text                     |           |          | 
 conninfo              | text                     |           |          |
    

文档: pg_stat_wal_receiver

pg_stat_wal_receiver (PostgreSQL 9.6)

            View "pg_catalog.pg_stat_wal_receiver"
        Column         |           Type           | Modifiers 
-----------------------+--------------------------+-----------
 pid                   | integer                  | 
 status                | text                     | 
 receive_start_lsn     | pg_lsn                   | 
 receive_start_tli     | integer                  | 
 received_lsn          | pg_lsn                   | 
 received_tli          | integer                  | 
 last_msg_send_time    | timestamp with time zone | 
 last_msg_receipt_time | timestamp with time zone | 
 latest_end_lsn        | pg_lsn                   | 
 latest_end_time       | timestamp with time zone | 
 slot_name             | text                     | 
 conninfo              | text                     |
    

文档: pg_stat_wal_receiver

更改历史记录

示例

-[ RECORD 1 ]---------+----------------------------------------------------------------------
pid                   | 99636
status                | streaming
receive_start_lsn     | 0/3000000
receive_start_tli     | 1
received_lsn          | 0/3001FE0
received_tli          | 1
last_msg_send_time    | 2019-06-01 15:57:46.097546+02
last_msg_receipt_time | 2019-06-01 15:57:46.097761+02
latest_end_lsn        | 0/3001FE0
latest_end_time       | 2019-06-01 15:43:14.741461+02
slot_name             | 
sender_host           | node1
sender_port           | 5432
conninfo              | user=postgres dbname=replication host=node1 port=5432
                        application_name=node2 fallback_application_name=walreceiver 

注意:“状态”可以是以下之一:

  • stopped (WALRCV_STOPPED)
  • starting (WALRCV_STARTING)
  • streaming (WALRCV_STREAMING)
  • waiting (WALRCV_WAITING)
  • restarting (WALRCV_RESTARTING)
  • stopping (WALRCV_STOPPING)

请参阅 src/backend/replication/walreceiver.c 中的函数 WalRcvGetStateString()

分类

复制统计/监控视图WAL

另请参阅

pg_stat_replication

反馈

提交任何关于“pg_stat_wal_receiver”的评论、建议或更正 此处