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 @@
# rpm -ivh pg_rman-x.x.xx-x.pgxx.rhelx.x86_64.rpm
-以下の表は、バックアップ・リカバリ処理をpg_rmanからPostgreSQL標準のpg_basebackupへ切り替えるための機能比較表です。
+近年のpg_basebackupの機能向上(増分バックアップ対応等)によりpg_rmanの代替が可能となったケースや、pg_rmanが利用できない環境への移行などを想定しています。
+ +| カテゴリ | +項目 | +pg_rman | +pg_basebackup | +注意点 | +
|---|---|---|---|---|
| バックアップ | +全体バックアップ | +pg_rman backup -b full |
+ pg_basebackup -D /path/to/backup |
+ + |
| 増分バックアップ | +pg_rman backup -b incremental |
+ pg_basebackup -i /path/to/backup/backup_manifest -D /path/to/backup |
+ pg_basebackupの増分バックアップはPostgreSQL 17以降で使用可能。-iには前回バックアップのbackup_manifestを指定する。 |
+ |
| アーカイブWAL | +pg_rman backup -b archive |
+ cpコマンド等OSコマンドで実施可能例: cp $ARCLOG_PATH/* /path/to/backup/arclog/ |
+ + | |
| サーバログ | +pg_rman backup -b full -s |
+ cpコマンド等OSコマンドで実施可能例: cp $SRVLOG_PATH/* /path/to/backup/srvlog/ |
+ pg_basebackup自体にサーバログのバックアップ機能はないが、log_directoryをデータベースクラスタ配下に指定すればpg_basebackup実行時にバックアップされる。 |
+ |
| テーブル空間 | +pg_rman backup -b full |
+ pg_basebackup -D /path/to/backup |
+ pg_rman、pg_basebackupともにテーブル空間は自動的にバックアップされるためオプション指定は不要。pg_basebackupのplain形式でテーブル空間のパスを変更する場合は--tablespace-mappingオプションを使用する。 |
+ |
| zlib圧縮 | +pg_rman backup -b full -Z |
+ pg_basebackup -D /path/to/backup -Z gzip |
+ pg_basebackupはzlib形式をサポートしないが、gzip(zlibと同じdeflateアルゴリズム)、lz4、zstdによる圧縮が可能 |
+ |
| サーバーサイド圧縮 | +pg_rman backup -b full -Z |
+ pg_basebackup -D /path/to/backup -F t -Z server-gzip |
+ pg_rmanはサーバサイドで動作するため、圧縮は常にサーバサイドで行われる。pg_basebackupはクライアントサイドでの圧縮(デフォルト)もサポート。 |
+ |
| チェックポイントの実行 | +pg_rman backup -b full -C |
+ pg_basebackup -D /path/to/backup -c {fast|spread} |
+ + | |
| 保持世代数の指定 | +pg_rman backup -b full --keep-data-generations 7 |
+ cronなどで実行例: ls -dt /path/to/backup/*/ | tail -n +8 | xargs rm -rf |
+ バックアップを7世代残すコマンド例 | +|
| 保持日数の指定 | +pg_rman backup -b full --keep-data-days 7 |
+ cronなどで実行例: 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 7 |
+ cronなどで実行例: 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 7 |
+ cronなどで実行例: 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 7 |
+ cronなどで実行例: ls -t $SRVLOG_PATH/* | tail -n +8 | xargs rm -f |
+ + | |
| サーバログの保持日数 | +pg_rman backup -b full -s --keep-srvlog-days 7 |
+ cronなどで実行例: find $SRVLOG_PATH -maxdepth 1 -mindepth 1 -type f -mtime +7 -delete |
+ + | |
| リカバリ | +ターゲットにタイムラインを指定 | +pg_rman restore --recovery-target-timeline 2 |
+ postgresql.confにrecovery_target_timeline = '2'を指定してリストアを実行 |
+ + |
| ターゲットにタイムスタンプを指定 | +pg_rman restore --recovery-target-time '2025-07-04 16:00:00' |
+ postgresql.confにrecovery_target_time = '2025-07-04 16:00:00'を指定してリストアを実行 |
+ + | |
| ターゲットにトランザクションIDを指定 | +pg_rman restore --recovery-target-xid 480000 |
+ postgresql.confにrecovery_target_xid = '480000'を指定してリストアを実行 |
+ + | |
| ターゲットの直後に停止 | +pg_rman restore --recovery-target-time "2025-07-04 16:00:00" --recovery-target-inclusive true |
+ postgresql.confにrecovery_target_inclusive = onを指定してリストアを実行(デフォルトon) |
+ + | |
| ターゲットの直前に停止 | +pg_rman restore --recovery-target-time "2025-07-04 16:00:00" --recovery-target-inclusive false |
+ postgresql.confにrecovery_target_inclusive = offを指定してリストアを実行 |
+ + | |
| ターゲット到達後に休止 | +pg_rman restore --recovery-target-action pause |
+ postgresql.confにrecovery_target_action = 'pause'を指定してリストアを実行 |
+ + | |
| ターゲット到達後にサーバー受付開始 | +pg_rman restore --recovery-target-action promote |
+ postgresql.confにrecovery_target_action = 'promote'を指定してリストアを実行 |
+ + | |
| ターゲット到達後にシャットダウン | +pg_rman restore --recovery-target-action shutdown |
+ postgresql.confにrecovery_target_action = 'shutdown'を指定してリストアを実行 |
+ + | |
| アーカイブWALをアーカイブ格納領域にコピー | +pg_rman restore --hard-copy |
+ cpコマンド等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=5433 |
+ pg_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 showpg_rman show detail |
+ lsコマンド等OSコマンドで実施可能例: ls -lt /path/to/backup/ |
+ pg_basebackupにはバックアップカタログがないため、ディレクトリ一覧(ls等)で見えるバックアップのみが対象となる。 |
+ |
| バックアップデータの検証 | +pg_rman validate |
+ pg_verifybackup /path/to/backup/2025-07-04_153000 |
+ + | |
| バックアップを削除 | +pg_rman delete 2025-07-04 15:30:00 |
+ rmコマンド等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 -v |
+ pg_basebackup -t blackhole -Xfetch -v |
+ pg_rmanの-cオプションはサーバ側の処理を行わない真のドライランだが、pg_basebackupの-t blackholeはサーバ側でバックアップ処理が実行され、クライアント側で受信データを破棄するのみ。pg_basebackupには厳密なドライラン機能はない。 |
+
| 処理内容を表示 | +pg_rman backup -b full -v |
+ pg_basebackup -D /path/to/backup -v |
+ + | |
| 処理の進捗を表示 | +pg_rman backup -b full -P |
+ pg_basebackup -D /path/to/backup -P |
+ + |
# rpm -ivh pg_rman-x.x.xx-x.pgxx.rhelx.x86_64.rpm
+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.
+ +| Category | +Item | +pg_rman | +pg_basebackup | +Notes | +
|---|---|---|---|---|
| Backup | +Full backup | +pg_rman backup -b full |
+ pg_basebackup -D /path/to/backup |
+ + |
| Incremental backup | +pg_rman backup -b incremental |
+ pg_basebackup -i /path/to/backup/backup_manifest -D /path/to/backup |
+ Incremental backup in pg_basebackup is available in PostgreSQL 17 and later. Specify the previous backup's backup_manifest with -i. |
+ |
| Archive WAL | +pg_rman backup -b archive |
+ Use OS commands such as cpe.g. cp $ARCLOG_PATH/* /path/to/backup/arclog/ |
+ + | |
| Server log | +pg_rman backup -b full -s |
+ Use OS commands such as cpe.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. |
+ |
| Tablespace | +pg_rman backup -b full |
+ pg_basebackup -D /path/to/backup |
+ Both pg_rman and pg_basebackup back up tablespaces automatically; no option is required. For plain format, use --tablespace-mapping to change tablespace paths. |
+ |
| zlib compression | +pg_rman backup -b full -Z |
+ pg_basebackup -D /path/to/backup -Z gzip |
+ pg_basebackup does not support zlib format but supports gzip (same deflate algorithm as zlib), lz4, and zstd. |
+ |
| Server-side compression | +pg_rman backup -b full -Z |
+ pg_basebackup -D /path/to/backup -F t -Z server-gzip |
+ pg_rman runs on the server, so compression is always server-side. pg_basebackup also supports client-side compression (default). |
+ |
| Checkpoint execution | +pg_rman backup -b full -C |
+ pg_basebackup -D /path/to/backup -c {fast|spread} |
+ + | |
| Retention by number of generations | +pg_rman backup -b full --keep-data-generations 7 |
+ Use 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 days | +pg_rman backup -b full --keep-data-days 7 |
+ Use 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 7 |
+ Use 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 7 |
+ Use 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 7 |
+ Use 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 7 |
+ Use cron etc.e.g. find $SRVLOG_PATH -maxdepth 1 -mindepth 1 -type f -mtime +7 -delete |
+ + | |
| Recovery | +Specify timeline as recovery target | +pg_rman restore --recovery-target-timeline 2 |
+ Set recovery_target_timeline = '2' in postgresql.conf and run restore |
+ + |
| Specify timestamp as recovery target | +pg_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 target | +pg_rman restore --recovery-target-xid 480000 |
+ Set recovery_target_xid = '480000' in postgresql.conf and run restore |
+ + | |
| Stop after target | +pg_rman restore --recovery-target-time "2025-07-04 16:00:00" --recovery-target-inclusive true |
+ Set recovery_target_inclusive = on in postgresql.conf and run restore (default is on) |
+ + | |
| Stop before target | +pg_rman restore --recovery-target-time "2025-07-04 16:00:00" --recovery-target-inclusive false |
+ Set recovery_target_inclusive = off in postgresql.conf and run restore |
+ + | |
| Pause after reaching target | +pg_rman restore --recovery-target-action pause |
+ Set recovery_target_action = 'pause' in postgresql.conf and run restore |
+ + | |
| Promote after reaching target | +pg_rman restore --recovery-target-action promote |
+ Set recovery_target_action = 'promote' in postgresql.conf and run restore |
+ + | |
| Shutdown after reaching target | +pg_rman restore --recovery-target-action shutdown |
+ Set recovery_target_action = 'shutdown' in postgresql.conf and run restore |
+ + | |
| Copy archive WAL to archive storage | +pg_rman restore --hard-copy |
+ Use OS commands such as cpe.g. cp /path/to/backup/arclog/* $ARCLOG_PATH/ |
+ + | |
| Symbolic links to archive WAL | +pg_rman restore (default) |
+ Use OS commands such as ln -se.g. ln -s /path/to/backup/arclog/* $ARCLOG_PATH/ |
+ + | |
| Backup at standby site | +Backup standby server data | +pg_rman backup -D /home/postgres/pgdata_sby -b full -h master --standby-host=192.168.0.20 --standby-port=5433 |
+ pg_basebackup -h 192.168.0.20 -p 5433 -D /path/to/backup_sby |
+ Example: standby host 192.168.0.20, standby port 5433 | +
| Backup catalog management | +Catalog initialization | +pg_rman init -B ${PWD}/rman_backup |
+ - | +Not needed; pg_basebackup has no backup catalog concept |
+
| Show backup history | +pg_rman showpg_rman show detail |
+ Use OS commands such as lse.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 data | +pg_rman validate |
+ pg_verifybackup /path/to/backup/2025-07-04_153000 |
+ + | |
| Delete backup | +pg_rman delete 2025-07-04 15:30:00 |
+ Use OS commands such as rme.g. rm -rf /path/to/backup/2025-07-04_153000 |
+ + | |
| Purge deleted backups | +pg_rman purge |
+ - | +Not needed; pg_basebackup has no backup catalog concept |
+ |
| List including deleted | +pg_rman show -a |
+ - | +Not needed; pg_basebackup has no backup catalog concept |
+ |
| Other | +Verify operation (dry run) | +pg_rman backup -b full -c -v |
+ pg_basebackup -t blackhole -Xfetch -v |
+ pg_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 details | +pg_rman backup -b full -v |
+ pg_basebackup -D /path/to/backup -v |
+ + | |
| Show progress | +pg_rman backup -b full -P |
+ pg_basebackup -D /path/to/backup -P |
+ + |