Three discovery tasks when working with PostgreSQL master/replica — and how to solve them
Summary
This article explains how to discover the right PostgreSQL node in a master/replica setup and how to handle failover safely. It compares several approaches, including DNS, libpq multi-host, HAProxy, pgpool-II, Patroni, and a custom pg-status HTTP service. It also shows how to support read-your-writes behavior by tracking WAL LSN values and routing reads to replicas that are sufficiently up to date. The article includes implementation examples in Python and FastAPI and demonstrates how the pg-status service can simplify application-level database routing.
Classifications
industries
No industries detected
applications
Web and Content Management
AskAI Classifications
Labels
Developer Tools
DevOps Software
Container Management Software
Linked Companies
Docker
$50M to $100M