Postgres 16 introduced logical replication from stand-by servers, enabling CDC tools like Debezium to connect to replicas instead of the primary. A fix was contributed to Debezium 2.5.0.Beta1 to use `pg_last_wal_receive_lsn()` instead of `pg_current_wal_lsn()` when connecting to a stand-by. The post walks through setting up Debezium with Kafka Connect against a Postgres stand-by on Amazon RDS, including the requirement to manually create publications on the primary. It also covers the failover slot problem: since logical replication slots are not propagated to stand-bys, a workaround involves maintaining parallel slots on both primary and stand-by and periodically advancing the stand-by slot using `pg_replication_slot_advance()` with the confirmed flush LSN from the primary. This minimizes data gaps and duplicates during failover until native failover slot support lands in a future Postgres release.

8m read timeFrom morling.dev
Post cover image

Sort: