pgBackRestのstanzaを作成し、アーカイブを検証(stanza-create/check)
PostgreSQLバックアップとPITRコマンド
# Create the stanza in the repository (once):
sudo -u postgres pgbackrest --stanza=<stanza> --log-level-console=info stanza-create
# Verify configuration and archiving end to end (switches WAL and waits for the segment to reach the repo):
sudo -u postgres pgbackrest --stanza=<stanza> --log-level-console=info check概要
stanza-createはリポジトリにクラスタのメタデータ(システム識別子、バージョン)を作成する。checkは実際のWALスイッチによって、PostgreSQL接続、archive_command、リポジトリへのWAL到着をテストする。
使用する場面
初期設定時、archive_commandやリポジトリの変更後、監視/cronのヘルスチェックとして。
注意
コマンドはpostgres(またはリポジトリ所有者)で実行する。rootで実行するとファイル所有権が壊れる。メジャーバージョンアップグレード後は、stanza-createではなくstanza-upgradeが必要。checkが失敗した場合、バックアップが完了してもPITRが不可能な場合がある。