DBAtlas · Veritabanı operasyon atlası

pgBackRest için WAL arşivlemeyi yapılandır (archive-push/archive-get)

PostgreSQLYedekleme & PITR

Komut

# postgresql.conf (archive_mode değişikliği restart ister):
wal_level = replica
archive_mode = on
archive_command = 'pgbackrest --stanza=<stanza> archive-push %p'
# Restore/standby tarafında (PG12+ postgresql.conf içinde):
restore_command = 'pgbackrest --stanza=<stanza> archive-get %f "%p"'

# /etc/pgbackrest/pgbackrest.conf (DB sunucusu, yerel repo örneği):
[global]
repo1-path=/var/lib/pgbackrest
repo1-retention-full=2
archive-async=y
spool-path=/var/spool/pgbackrest
process-max=4
compress-type=zst
start-fast=y

[<stanza>]
pg1-path=/var/lib/pgsql/16/data

Ne yapar?

PostgreSQL'in her tamamlanan WAL segmentini pgBackRest deposuna göndermesini (archive-push) ve recovery sırasında oradan çekmesini (archive-get) sağlar; archive-async ile gönderim paralel ve spool üzerinden asenkron yapılır.

Ne zaman kullanılır?

pgBackRest ile fiziksel yedek ve PITR kurulumunun ilk adımı olarak, stanza-create'ten önce.

Dikkat

archive_command başarısız olduğu sürece WAL pg_wal'da birikir ve disk dolarsa primary durur; pg_stat_archiver.failed_count'u izle. Patroni kullanıyorsan bu parametreleri postgresql.conf yerine patroni.yml / edit-config ile ver. Aynı stanza'ya iki farklı kümeden arşiv göndermek depoyu bozar.

DBAtlas'ta aç →

İlgili