SHOW SLAVE HOSTS

功能描述

查看wal(xlog)日志同步状态信息,例如发起端发送日志位置,接收端接收日志位置等。

注意事项

  • 在主库执行有效。
  • 展示结果和select * from pg_stat_replication一致。

语法格式

  1. SHOW SLAVE HOSTS

参数说明

  • pid

    1. 线程的PID
  • usesysid

    1. 用户系统ID
  • usename

    1. 用户名。
  • application_name

    1. 程序名称。
  • client_addr

    1. 客户端地址。
  • client_port

    1. 客户端端口。
  • backend_start

    1. 程序启动时间。
  • state

    1. 日志复制的状态:
    2. 追赶状态、
    3. 一致的流状态。
  • sender_sent_location

    1. 发送端发送日志位置。
  • receiver_write_location

    1. 接收端write日志位置。
  • receiver_flush_location

    1. 接收端flush日志位置。
  • receiver_replay_location

    1. 接收端replay日志位置。
  • sync_priority

    1. 同步复制的优先级(0表示异步)。
  • sync_priority

    1. 同步状态:
    2. 异步复制、
    3. 同步复制、
    4. 潜在同步者。

示例

  1. openGauss=# show slave hosts;
  2. -[ RECORD 1 ]------------+----------------------------------
  3. pid | 140395615176448
  4. usesysid | 10
  5. usename | opengauss
  6. application_name | WalSender to Standby[walreceiver]
  7. client_addr | 127.0.0.1
  8. client_hostname |
  9. client_port | 43174
  10. backend_start | 2022-08-23 18:41:12.398717+08
  11. state | Streaming
  12. sender_sent_location | 0/1098BB08
  13. receiver_write_location | 0/1098BB08
  14. receiver_flush_location | 0/1098BB08
  15. receiver_replay_location | 0/1098BB08
  16. sync_priority | 1
  17. sync_state | Sync