Menu

1 / 19

Protecting the source of a PostgreSQL CDC mirror: a step-by-step walkthrough in Hydra Studio

DEV Community: database·Bechir Bejaoui·about 15 hours ago
#oyTUqvrl
#devtodatabase#devto#dev#hydra#mirror
Reading 0:00
15s threshold

This walkthrough shows what Hydra ETL does on a real PostgreSQL 16 to protect the source of CDC mirror, in four scenes:

A normal mirror.

The mirror breaks and the WAL piles up: Hydra ETL warns, and a workflow sends an alert.

max_slot_wal_keep_size protects the disk and PostgreSQL invalidates the slot: Hydra ETL stops instead of going on with a gap.

Rebuilding the mirror.

Every screenshot below comes from this exact sequence, run end to end.

0. Prerequisites

Docker

Python 3.10+

The Hydra ETL repository: https://github.com/bejaouibechir/Hydra

Start PostgreSQL with logical replication:

docker run --name hydra-pg-cdc -e POSTGRES_PASSWORD = hydra -p 5433:5432 -d postgres:16 -c wal_level = logical

Enter fullscreen mode

Exit fullscreen mode

Go to the example, create its .env , and create the two databases: shop (the application) and analytics (the mirror):

git clone https://github.com/bejaouibechir/hydra-tuto-cdc-slot-protection.git cd examples/postgres-cdc-mirror printf…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.