Postgres Streaming Replication

Replication is the foundation of Postgres HA. Setup is fewer steps than people expect.

Step 1: Configure primary

Streaming replication starts on the primary. A handful of conf settings enable WAL streaming; everything else flows from there.

Step 2: Take base backup

Step 3: Start replica

The replica needs to know it is a standby and where to stream from. The signal file is the modern way; recovery.conf is gone.

Step 4: Verify replication

Replication looks fine until you check it. Two queries confirm the link is live and the lag is acceptable.

Antipatterns

What to do this week

Three moves. (1) Run the tutorial end-to-end on your own laptop / sandbox. (2) Apply the pattern to one production workload. (3) Document the variations you needed; share with the team.