diff --git a/docs/index-ja.html b/docs/index-ja.html index c5f17b8..309052c 100644 --- a/docs/index-ja.html +++ b/docs/index-ja.html @@ -24,6 +24,7 @@

pg_rman 1.3

  • 外部スクリプトとの連携
  • ダウンロード
  • インストール方法
  • +
  • pg_basebackupへの移行
  • 動作環境
  • 関連項目
  • @@ -1457,7 +1458,234 @@

    RPMを用いたインストール

    # rpm -ivh pg_rman-x.x.xx-x.pgxx.rhelx.x86_64.rpm
     
    -

    動作環境

    +

    pg_basebackupへの移行

    +

    以下の表は、バックアップ・リカバリ処理をpg_rmanからPostgreSQL標準のpg_basebackupへ切り替えるための機能比較表です。

    +

    近年のpg_basebackupの機能向上(増分バックアップ対応等)によりpg_rmanの代替が可能となったケースや、pg_rmanが利用できない環境への移行などを想定しています。

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    カテゴリ項目pg_rmanpg_basebackup注意点
    バックアップ全体バックアップpg_rman backup -b fullpg_basebackup -D /path/to/backup
    増分バックアップpg_rman backup -b incrementalpg_basebackup -i /path/to/backup/backup_manifest -D /path/to/backuppg_basebackupの増分バックアップはPostgreSQL 17以降で使用可能。-iには前回バックアップのbackup_manifestを指定する。
    アーカイブWALpg_rman backup -b archivecpコマンド等OSコマンドで実施可能
    例: cp $ARCLOG_PATH/* /path/to/backup/arclog/
    サーバログpg_rman backup -b full -scpコマンド等OSコマンドで実施可能
    例: cp $SRVLOG_PATH/* /path/to/backup/srvlog/
    pg_basebackup自体にサーバログのバックアップ機能はないが、log_directoryをデータベースクラスタ配下に指定すればpg_basebackup実行時にバックアップされる。
    テーブル空間pg_rman backup -b fullpg_basebackup -D /path/to/backuppg_rmanpg_basebackupともにテーブル空間は自動的にバックアップされるためオプション指定は不要。pg_basebackupのplain形式でテーブル空間のパスを変更する場合は--tablespace-mappingオプションを使用する。
    zlib圧縮pg_rman backup -b full -Zpg_basebackup -D /path/to/backup -Z gzippg_basebackupはzlib形式をサポートしないが、gzip(zlibと同じdeflateアルゴリズム)、lz4、zstdによる圧縮が可能
    サーバーサイド圧縮pg_rman backup -b full -Zpg_basebackup -D /path/to/backup -F t -Z server-gzippg_rmanはサーバサイドで動作するため、圧縮は常にサーバサイドで行われる。pg_basebackupはクライアントサイドでの圧縮(デフォルト)もサポート。
    チェックポイントの実行pg_rman backup -b full -Cpg_basebackup -D /path/to/backup -c {fast|spread}
    保持世代数の指定pg_rman backup -b full --keep-data-generations 7cronなどで実行
    例: ls -dt /path/to/backup/*/ | tail -n +8 | xargs rm -rf
    バックアップを7世代残すコマンド例
    保持日数の指定pg_rman backup -b full --keep-data-days 7cronなどで実行
    例: find /path/to/backup -maxdepth 1 -mindepth 1 -type d -mtime +7 -exec rm -rf {} +
    バックアップを7日間残すコマンド例
    アーカイブWALの保持ファイル数pg_rman backup -b full --keep-arclog-files 7cronなどで実行
    例: pg_archivecleanup $ARCLOG_PATH $(basename "$(ls -t $ARCLOG_PATH/*.backup | sed -n '7p')")
    pg_basebackupの例は直近7世代分のバックアップに必要なWALを残すコマンド例。フルバックアップごとに.backupファイルがアーカイブされる前提で、7番目に新しい.backupファイルを指定し、それより古いWALを削除する。
    アーカイブWALの保持日数pg_rman backup -b full --keep-arclog-days 7cronなどで実行
    例: pg_archivecleanup $ARCLOG_PATH $(basename "$(find $ARCLOG_PATH -maxdepth 1 -name '*.backup' -mtime +7 | sort | tail -1)")
    pg_basebackupの例は7日分のWALを残すコマンド例。フルバックアップごとに.backupファイルがアーカイブされる前提で、7日より古い.backupファイルのうち最新のものを指定し、それより古いWALを削除する。
    サーバログの保持ファイル数pg_rman backup -b full -s --keep-srvlog-files 7cronなどで実行
    例: ls -t $SRVLOG_PATH/* | tail -n +8 | xargs rm -f
    サーバログの保持日数pg_rman backup -b full -s --keep-srvlog-days 7cronなどで実行
    例: find $SRVLOG_PATH -maxdepth 1 -mindepth 1 -type f -mtime +7 -delete
    リカバリターゲットにタイムラインを指定pg_rman restore --recovery-target-timeline 2postgresql.confrecovery_target_timeline = '2'を指定してリストアを実行
    ターゲットにタイムスタンプを指定pg_rman restore --recovery-target-time '2025-07-04 16:00:00'postgresql.confrecovery_target_time = '2025-07-04 16:00:00'を指定してリストアを実行
    ターゲットにトランザクションIDを指定pg_rman restore --recovery-target-xid 480000postgresql.confrecovery_target_xid = '480000'を指定してリストアを実行
    ターゲットの直後に停止pg_rman restore --recovery-target-time "2025-07-04 16:00:00" --recovery-target-inclusive truepostgresql.confrecovery_target_inclusive = onを指定してリストアを実行(デフォルトon)
    ターゲットの直前に停止pg_rman restore --recovery-target-time "2025-07-04 16:00:00" --recovery-target-inclusive falsepostgresql.confrecovery_target_inclusive = offを指定してリストアを実行
    ターゲット到達後に休止pg_rman restore --recovery-target-action pausepostgresql.confrecovery_target_action = 'pause'を指定してリストアを実行
    ターゲット到達後にサーバー受付開始pg_rman restore --recovery-target-action promotepostgresql.confrecovery_target_action = 'promote'を指定してリストアを実行
    ターゲット到達後にシャットダウンpg_rman restore --recovery-target-action shutdownpostgresql.confrecovery_target_action = 'shutdown'を指定してリストアを実行
    アーカイブWALをアーカイブ格納領域にコピーpg_rman restore --hard-copycpコマンド等OSコマンドで実施可能
    例: cp /path/to/backup/arclog/* $ARCLOG_PATH/
    アーカイブWALへのシンボリックリンクpg_rman restore(デフォルト動作)ln -sコマンド等OSコマンドで実施可能
    例: ln -s /path/to/backup/arclog/* $ARCLOG_PATH/
    スタンバイサイトでのバックアップスタンバイサーバー側の情報をバックアップpg_rman backup -D /home/postgres/pgdata_sby -b full -h master --standby-host=192.168.0.20 --standby-port=5433pg_basebackup -h 192.168.0.20 -p 5433 -D /path/to/backup_sby例はスタンバイサイトのホスト: 192.168.0.20、スタンバイサイトのポート番号: 5433
    バックアップカタログ管理カタログの初期化pg_rman init -B ${PWD}/rman_backup-pg_basebackupにはバックアップカタログの概念がないため不要
    過去のバックアップ履歴を表示pg_rman show
    pg_rman show detail
    lsコマンド等OSコマンドで実施可能
    例: ls -lt /path/to/backup/
    pg_basebackupにはバックアップカタログがないため、ディレクトリ一覧(ls等)で見えるバックアップのみが対象となる。
    バックアップデータの検証pg_rman validatepg_verifybackup /path/to/backup/2025-07-04_153000
    バックアップを削除pg_rman delete 2025-07-04 15:30:00rmコマンド等OSコマンドで実施可能
    例: rm -rf /path/to/backup/2025-07-04_153000
    削除済みバックアップの消去pg_rman purge-pg_basebackupにはバックアップカタログの概念がないため不要
    削除済みも含めて一覧表示pg_rman show -a-pg_basebackupにはバックアップカタログの概念がないため不要
    その他処理内容を確認pg_rman backup -b full -c -vpg_basebackup -t blackhole -Xfetch -vpg_rman-cオプションはサーバ側の処理を行わない真のドライランだが、pg_basebackup-t blackholeはサーバ側でバックアップ処理が実行され、クライアント側で受信データを破棄するのみ。pg_basebackupには厳密なドライラン機能はない。
    処理内容を表示pg_rman backup -b full -vpg_basebackup -D /path/to/backup -v
    処理の進捗を表示pg_rman backup -b full -Ppg_basebackup -D /path/to/backup -P
    + +

    動作環境

    PostgreSQLバージョン
    PostgreSQL 14, 15, 16, 17, 18
    @@ -1466,7 +1694,7 @@

    動作環境

    -

    関連項目

    +

    関連項目

    バックアップとリストア
    diff --git a/docs/index.html b/docs/index.html index 0598b0d..dc51f6f 100644 --- a/docs/index.html +++ b/docs/index.html @@ -25,6 +25,7 @@

    pg_rman 1.3

  • External Scripts
  • Download
  • Installation
  • +
  • Migration to pg_basebackup
  • Requirements
  • See Also
  • @@ -1446,6 +1447,232 @@

    Install from rpm package

    # rpm -ivh pg_rman-x.x.xx-x.pgxx.rhelx.x86_64.rpm
     
    +

    Migration to pg_basebackup

    +

    The following table provides a feature comparison for migrating backup and recovery processes from pg_rman to the standard pg_basebackup command.

    +

    This is intended for cases where pg_rman can be replaced due to recent improvements in pg_basebackup functionality and performance, or for migration to cloud environments where pg_rman is not available.

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    CategoryItempg_rmanpg_basebackupNotes
    BackupFull backuppg_rman backup -b fullpg_basebackup -D /path/to/backup
    Incremental backuppg_rman backup -b incrementalpg_basebackup -i /path/to/backup/backup_manifest -D /path/to/backupIncremental backup in pg_basebackup is available in PostgreSQL 17 and later. Specify the previous backup's backup_manifest with -i.
    Archive WALpg_rman backup -b archiveUse OS commands such as cp
    e.g. cp $ARCLOG_PATH/* /path/to/backup/arclog/
    Server logpg_rman backup -b full -sUse OS commands such as cp
    e.g. cp $SRVLOG_PATH/* /path/to/backup/srvlog/
    pg_basebackup does not back up server logs by itself, but if log_directory is under the database cluster, logs are included when running pg_basebackup.
    Tablespacepg_rman backup -b fullpg_basebackup -D /path/to/backupBoth pg_rman and pg_basebackup back up tablespaces automatically; no option is required. For plain format, use --tablespace-mapping to change tablespace paths.
    zlib compressionpg_rman backup -b full -Zpg_basebackup -D /path/to/backup -Z gzippg_basebackup does not support zlib format but supports gzip (same deflate algorithm as zlib), lz4, and zstd.
    Server-side compressionpg_rman backup -b full -Zpg_basebackup -D /path/to/backup -F t -Z server-gzippg_rman runs on the server, so compression is always server-side. pg_basebackup also supports client-side compression (default).
    Checkpoint executionpg_rman backup -b full -Cpg_basebackup -D /path/to/backup -c {fast|spread}
    Retention by number of generationspg_rman backup -b full --keep-data-generations 7Use cron etc.
    e.g. ls -dt /path/to/backup/*/ | tail -n +8 | xargs rm -rf
    Example to keep 7 generations of backups
    Retention by number of dayspg_rman backup -b full --keep-data-days 7Use cron etc.
    e.g. find /path/to/backup -maxdepth 1 -mindepth 1 -type d -mtime +7 -exec rm -rf {} +
    Example to keep backups for 7 days
    Archive WAL retention (file count)pg_rman backup -b full --keep-arclog-files 7Use cron etc.
    e.g. pg_archivecleanup $ARCLOG_PATH $(basename "$(ls -t $ARCLOG_PATH/*.backup | sed -n '7p')")
    pg_basebackup example keeps WAL needed for the latest 7 backups. Assumes a .backup file is archived per full backup; specifies the 7th newest .backup and removes older WAL.
    Archive WAL retention (days)pg_rman backup -b full --keep-arclog-days 7Use cron etc.
    e.g. pg_archivecleanup $ARCLOG_PATH $(basename "$(find $ARCLOG_PATH -maxdepth 1 -name '*.backup' -mtime +7 | sort | tail -1)")
    pg_basebackup example keeps 7 days of WAL. Assumes a .backup file is archived per full backup; specifies the newest .backup older than 7 days and removes older WAL.
    Server log retention (file count)pg_rman backup -b full -s --keep-srvlog-files 7Use cron etc.
    e.g. ls -t $SRVLOG_PATH/* | tail -n +8 | xargs rm -f
    Server log retention (days)pg_rman backup -b full -s --keep-srvlog-days 7Use cron etc.
    e.g. find $SRVLOG_PATH -maxdepth 1 -mindepth 1 -type f -mtime +7 -delete
    RecoverySpecify timeline as recovery targetpg_rman restore --recovery-target-timeline 2Set recovery_target_timeline = '2' in postgresql.conf and run restore
    Specify timestamp as recovery targetpg_rman restore --recovery-target-time '2025-07-04 16:00:00'Set recovery_target_time = '2025-07-04 16:00:00' in postgresql.conf and run restore
    Specify transaction ID as recovery targetpg_rman restore --recovery-target-xid 480000Set recovery_target_xid = '480000' in postgresql.conf and run restore
    Stop after targetpg_rman restore --recovery-target-time "2025-07-04 16:00:00" --recovery-target-inclusive trueSet recovery_target_inclusive = on in postgresql.conf and run restore (default is on)
    Stop before targetpg_rman restore --recovery-target-time "2025-07-04 16:00:00" --recovery-target-inclusive falseSet recovery_target_inclusive = off in postgresql.conf and run restore
    Pause after reaching targetpg_rman restore --recovery-target-action pauseSet recovery_target_action = 'pause' in postgresql.conf and run restore
    Promote after reaching targetpg_rman restore --recovery-target-action promoteSet recovery_target_action = 'promote' in postgresql.conf and run restore
    Shutdown after reaching targetpg_rman restore --recovery-target-action shutdownSet recovery_target_action = 'shutdown' in postgresql.conf and run restore
    Copy archive WAL to archive storagepg_rman restore --hard-copyUse OS commands such as cp
    e.g. cp /path/to/backup/arclog/* $ARCLOG_PATH/
    Symbolic links to archive WALpg_rman restore (default)Use OS commands such as ln -s
    e.g. ln -s /path/to/backup/arclog/* $ARCLOG_PATH/
    Backup at standby siteBackup standby server datapg_rman backup -D /home/postgres/pgdata_sby -b full -h master --standby-host=192.168.0.20 --standby-port=5433pg_basebackup -h 192.168.0.20 -p 5433 -D /path/to/backup_sbyExample: standby host 192.168.0.20, standby port 5433
    Backup catalog managementCatalog initializationpg_rman init -B ${PWD}/rman_backup-Not needed; pg_basebackup has no backup catalog concept
    Show backup historypg_rman show
    pg_rman show detail
    Use OS commands such as ls
    e.g. ls -lt /path/to/backup/
    With pg_basebackup there is no catalog; only backups visible in the directory listing (ls etc.) are relevant.
    Validate backup datapg_rman validatepg_verifybackup /path/to/backup/2025-07-04_153000
    Delete backuppg_rman delete 2025-07-04 15:30:00Use OS commands such as rm
    e.g. rm -rf /path/to/backup/2025-07-04_153000
    Purge deleted backupspg_rman purge-Not needed; pg_basebackup has no backup catalog concept
    List including deletedpg_rman show -a-Not needed; pg_basebackup has no backup catalog concept
    OtherVerify operation (dry run)pg_rman backup -b full -c -vpg_basebackup -t blackhole -Xfetch -vpg_rman's -c is a true dry run (no server-side work). pg_basebackup's -t blackhole runs the backup on the server and only discards received data on the client; pg_basebackup has no strict dry-run mode.
    Show operation detailspg_rman backup -b full -vpg_basebackup -D /path/to/backup -v
    Show progresspg_rman backup -b full -Ppg_basebackup -D /path/to/backup -P

    Requirements

    @@ -1456,7 +1683,7 @@

    Requirements

    -

    See Also

    +

    See Also

    Backup and Restore