我看到 postgres 中关于复制和滞后时间的两种观点之间存在一些差异。
通过此查询,显然复制已启动:
9.5.6.11
postgres=# select client_addr, sent_location, replay_location from pg_stat_replication where application_name = 'walreceiver';
client_addr | sent_location | replay_location
----------------+---------------+-----------------
172.yyy.yyy.213 | 1C/2B5732F8 | 1C/2B5732F8
10.xxx.xxx.195 | 1C/2B5732F8 | 1C/2B5732F8
10.xxx.xxx.196 | 1C/2B5732F8 | 1C/2B5732F8
10.1
postgres=# select client_addr, sent_lsn, replay_lsn from pg_stat_replication where application_name = 'walreceiver';
client_addr | sent_lsn | replay_lsn
--------------+------------+------------
10.qqq.qqq.44 | 1/8C000140 | 1/8C000140
但是当寻找滞后时间时:
9.5.6.11
postgres-# SELECT pg_last_xlog_receive_location() , pg_last_xlog_replay_location() , now() , pg_last_xact_replay_timestamp();
pg_last_xlog_receive_location | pg_last_xlog_replay_location | now | pg_last_xact_replay_timestamp
-------------------------------+------------------------------+-------------------------------+-------------------------------
| | 2018-05-10 04:19:38.079161-04 |
10.1
postgres=# SELECT pg_last_wal_receive_lsn() , pg_last_wal_replay_lsn() , now() , pg_last_xact_replay_timestamp();
pg_last_wal_receive_lsn | pg_last_wal_replay_lsn | now | pg_last_xact_replay_timestamp
-------------------------+------------------------+-------------------------------+-------------------------------
| | 2018-05-10 04:29:21.730089-04 |
没有信息..我错过了什么?
看起来您正在主服务器上运行第二组查询。这些功能需要在副本上运行,而不是在主服务器上运行。