SK
DB ReplicationHA · Failover
/ sayha.cloud / projeler / db-replication
Demo Sim.streaming · PostgreSQL 16← geri

DB Replication / Streaming · Failover · Yüksek Erişilebilirlik

Neden: Ödeme veritabanları tek arıza noktası olamaz. PostgreSQL streaming replication ile primary→replica WAL aktarımı, otomatik failover ve okuma yükü dağıtımı kurdum. Primary çökerse replica saniyeler içinde promote olur, kesinti minimal. Aşağıda "Primary'i Öldür" ile failover senaryosunu test et — replica'nın nasıl devraldığını izle. Stack: PostgreSQL 16 · Patroni · streaming replication · WAL · pgBouncer.

Streaming ReplAuto-FailoverWAL Shipping0 Veri Kaybı
Cluster Durumu
Healthy
1 primary · 2 replica
Replication Lag
0.02sn
async · < 50ms hedef
WAL Throughput
4.2MB/s
LSN ilerliyor
Uptime
99.99%
son failover: 14 gün önce

Replication Topolojisi · Canlı

primary → streaming replica · WAL akışı
streaming
pg-node-01
PRIMARY
writes aktif
pg-node-02
REPLICA
lag 0.02s
pg-node-03
REPLICA
lag 0.03s

Replication Metrikleri

Replication Modeasync streaming
Current LSN0x4F2A8C10
Synced Replicas2 / 2
Failover ModePatroni otomatik
RPO / RTO~0 / <30s

Bağlantı Havuzu

pgBouncer · read/write split
Write bağlantı (primary)48 / 100
Read bağlantı (replica)126 / 200
Read/Write oranı73% / 27%
Idle bağlantı22
Query latency (p99)3.4ms