📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials PostgreSQL Essentials Replication Basics

Replication Basics

7 min read
Streaming replication copies WAL records from a primary to standby servers. Standbys can serve read-only queries to reduce load. Use synchronous replication for zero data loss on failover between servers.

Streaming Replication

PostgreSQL supports built-in streaming replication for high availability.

# On primary — postgresql.conf
wal_level = replica
max_wal_senders = 3

# On replica
primary_conninfo = 'host=primary port=5432 user=replicator'

# Create replication user
CREATE ROLE replicator REPLICATION LOGIN PASSWORD 'secret';