The standard docs for it work fine. Digital Ocean has good postgres docs too.
You want monitoring to watch replica lag. I have mine mapped in Grafana with prometheus scraping data. The functions replay_delay and replay_lag are helpful. If you're not writing though, the replica will just be an increasing line.
Here's a query to monitor the replica if you want to just test things from and console:
SELECT NOW() as time, extract(epoch from now() - pg_last_xact_replay_timestamp()) AS VALUE, 'foo' AS lag_type;
and here's one for the master:
SELECT
now() AS time,
r.client_addr,
m.lag_type,
EXTRACT(EPOCH FROM m.lag_interval)::double precision AS value
FROM pg_stat_replication r
CROSS JOIN LATERAL (
VALUES
('write_lag', r.write_lag),
('flush_lag', r.flush_lag),
('replay_lag', r.replay_lag)
) AS m(lag_type, lag_interval);
You probably want to generate alerts if your lag starts approaching the limits of your write-ahead logs.







