バージョンごとのドキュメント一覧

pg_combinebackup

pg_combinebackup <refpurpose>reconstruct a full backup from an incremental backup and dependent backups</refpurpose> — 増分バックアップと依存するバックアップ群からフルバックアップを再構築する

概要

pg_combinebackup [option...] [backup_directory...]

説明

<title>Description</title>

<application>pg_combinebackup</application> is used to reconstruct a synthetic full backup from an <link linkend="backup-incremental-backup">incremental backup</link> and the earlier backups upon which it depends. pg_combinebackupは、増分バックアップとそれが依存する以前のバックアップから、合成フルバックアップを再構築するために使用されます。

Specify all of the required backups on the command line from oldest to newest. That is, the first backup directory should be the path to the full backup, and the last should be the path to the final incremental backup that you wish to restore. The reconstructed backup will be written to the output directory specified by the <option>-o</option> option. コマンドラインで、古いバックアップから最新のバックアップまで、必要なすべてのバックアップを指定します。 つまり、最初のバックアップディレクトリはフルバックアップへのパスでなければならず、最後のバックアップはリストアしたい最後の増分バックアップへのパスでなければなりません。 再構築されたバックアップは、-oオプションで指定された出力ディレクトリに書き込まれます。

<application>pg_combinebackup</application> will attempt to verify that the backups you specify form a legal backup chain from which a correct full backup can be reconstructed. However, it is not designed to help you keep track of which backups depend on which other backups. If you remove one or more of the previous backups upon which your incremental backup relies, you will not be able to restore it. Moreover, <application>pg_combinebackup</application> only attempts to verify that the backups have the correct relationship to each other, not that each individual backup is intact; for that, use <xref linkend="app-pgverifybackup" />. pg_combinebackupは、指定したバックアップが正しいフルバックアップを再構築できる正当なバックアップチェーンを形成しているかどうかを検証します。 ただし、どのバックアップがどのバックアップに依存しているかを追跡するための機能は備えていません。 増分バックアップが依存する以前のバックアップを1つでも削除すると、その増分バックアップはリストアできなくなります。 さらに、pg_combinebackupは、バックアップが互いに正しい関係を持っているかどうかを検証するだけで、個々のバックアップが損なわれていないかどうかは検証しません。そのためにはpg_verifybackupを使用してください。

Since the output of <application>pg_combinebackup</application> is a synthetic full backup, it can be used as an input to a future invocation of <application>pg_combinebackup</application>. The synthetic full backup would be specified on the command line in lieu of the chain of backups from which it was reconstructed. pg_combinebackupの出力は合成フルバックアップであるため、将来のpg_combinebackupの呼び出しの入力として使用できます。 再構築に使われたバックアップチェーンの代わりに合成フルバックアップをコマンドラインで指定します。

オプション

<title>Options</title>

-d
--debug

Print lots of debug logging output on <filename>stderr</filename>. stderrに大量のデバッグログを出力します。

-n
--dry-run

The <option>-n</option>/<option>&#45;-dry-run</option> option instructs <command>pg_combinebackup</command> to figure out what would be done without actually creating the target directory or any output files. It is particularly useful in combination with <option>&#45;-debug</option>. -n/--dry-runオプションは、ターゲットディレクトリや出力ファイルを実際には作成せずに、pg_combinebackupが何を行うかを報告します。 これは--debugと組み合わせて使用すると特に便利です。

-N
--no-sync

By default, <command>pg_combinebackup</command> will wait for all files to be written safely to disk. This option causes <command>pg_combinebackup</command> to return without waiting, which is faster, but means that a subsequent operating system crash can leave the output backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation. デフォルトでは、pg_combinebackupはすべてのファイルがディスクに安全に書き込まれるまで待機します。 このオプションを指定すると、pg_combinebackupは待機せずに返ります。 これは高速ですが、後続のオペレーティングシステムのクラッシュによって出力バックアップが破損する可能性があります。 通常、このオプションは試験用では有用ですが、実用のインストレーションを作成する際に使用すべきではありません。

-o outputdir
--output=outputdir

Specifies the output directory to which the synthetic full backup should be written. Currently, this argument is required. 合成フルバックアップを書き込む出力ディレクトリを指定します。 現在、この引数は必須です。

-T olddir=newdir
--tablespace-mapping=olddir=newdir

Relocates the tablespace in directory <replaceable>olddir</replaceable> to <replaceable>newdir</replaceable> during the backup. <replaceable>olddir</replaceable> is the absolute path of the tablespace as it exists in the final backup specified on the command line, and <replaceable>newdir</replaceable> is the absolute path to use for the tablespace in the reconstructed backup. If either path needs to contain an equal sign (<literal>=</literal>), precede that with a backslash. This option can be specified multiple times for multiple tablespaces. バックアップ時にディレクトリolddir内のテーブル空間をnewdirに再配置します。 olddirはコマンドラインで指定された最終バックアップに存在するテーブル空間の絶対パスで、newdirは再構築されたバックアップでテーブル空間に使用される絶対パスです。 どちらかのパスに等号(=)が含まれる場合、その前にバックスラッシュを置きます。 このオプションは、複数のテーブル空間に対して複数回指定できます。

--clone

Use efficient file cloning (also known as <quote>reflinks</quote> on some systems) instead of copying files to the new data directory, which can result in near-instantaneous copying of the data files. 新しいデータディレクトリにファイルをコピーする代わりに、効率的なファイルクローニング(一部のシステムではreflinksとも呼ばれます)を使用します。これによりデータファイルをほぼ瞬時にコピーすることができます。

If a backup manifest is not available or does not contain checksum of the right type, file cloning will be used to copy the file, but the file will be also read block-by-block for the checksum calculation. バックアップマニフェストが使用できない場合、または正しいタイプのチェックサムが含まれていない場合、ファイルコピーのためにクローニングが使われますが、ファイルはチェックサム計算のためにブロックごとに読み取られます。

File cloning is only supported on some operating systems and file systems. If it is selected but not supported, the <application>pg_combinebackup</application> run will error. At present, it is supported on Linux (kernel 4.5 or later) with Btrfs and XFS (on file systems created with reflink support), and on macOS with APFS. ファイルのクローニングは、一部のオペレーティングシステムおよびファイルシステムでのみサポートされています。 選択されているけれどもサポートされていない場合、pg_combinebackupの実行はエラーになります。 現在、Linux(カーネル4.5以上)のBtrfsと、XFS(reflinkを有効にして作成されたファイルシステム)、および、macOSのAPFSでサポートされています。

--copy

Perform regular file copy. This is the default. (See also <option>&#45;-copy-file-range</option> and <option>&#45;-clone</option>.) 通常のファイルコピーを行います。 これがデフォルトです(--copy-file-rangeおよび--cloneも参照してください。)

--copy-file-range

Use the <function>copy_file_range</function> system call for efficient copying. On some file systems this gives results similar to <option>&#45;-clone</option>, sharing physical disk blocks, while on others it may still copy blocks, but do so via an optimized path. At present, it is supported on Linux and FreeBSD. システムコールcopy_file_rangeを使用して、効率的なコピーを行います。 ファイルシステムによって、物理ディスクブロックを共有して--cloneと似た効果を得られるものもあれば、依然としてブロックをコピーするものの最適化されたパスを介して動作するものもあります。 現在、LinuxとFreeBSDでサポートされています。

If a backup manifest is not available or does not contain checksum of the right type, <function>copy_file_range</function> will be used to copy the file, but the file will be also read block-by-block for the checksum calculation. バックアップマニフェストが利用できないか、正しいタイプのチェックサムを含んでいない場合、copy_file_rangeはファイルをコピーするために使用されますが、ファイルはチェックサム計算のためにブロックごとに読み取られます。

--manifest-checksums=algorithm

Like <xref linkend="app-pgbasebackup"/>, <application>pg_combinebackup</application> writes a backup manifest in the output directory. This option specifies the checksum algorithm that should be applied to each file included in the backup manifest. Currently, the available algorithms are <literal>NONE</literal>, <literal>CRC32C</literal>, <literal>SHA224</literal>, <literal>SHA256</literal>, <literal>SHA384</literal>, and <literal>SHA512</literal>. The default is <literal>CRC32C</literal>. pg_basebackupと同様に、pg_combinebackupはバックアップマニフェストを出力ディレクトリに書き込みます。 このオプションは、バックアップマニフェストに含まれる各ファイルに適用されるチェックサムアルゴリズムを指定します。 現在利用可能なアルゴリズムは、NONECRC32CSHA224SHA256SHA384SHA512です。 デフォルトはCRC32Cです。

--no-manifest

Disables generation of a backup manifest. If this option is not specified, a backup manifest for the reconstructed backup will be written to the output directory. バックアップマニフェストの生成を無効にします。 このオプションを指定しない場合、再構築されたバックアップのバックアップマニフェストが出力ディレクトリに書き込まれます。

--sync-method=method

When set to <literal>fsync</literal>, which is the default, <command>pg_combinebackup</command> will recursively open and synchronize all files in the backup directory. When the plain format is used, the search for files will follow symbolic links for the WAL directory and each configured tablespace. デフォルトのfsyncに設定すると、pg_combinebackupはバックアップディレクトリ内の全てのファイルを再帰的にオープンして同期します。 plain形式を使用する場合、ファイルの検索はWALディレクトリと設定された各テーブル空間のシンボリックリンクをたどります。

On Linux, <literal>syncfs</literal> may be used instead to ask the operating system to synchronize the whole file system that contains the backup directory. When the plain format is used, <command>pg_combinebackup</command> will also synchronize the file systems that contain the WAL files and each tablespace. See <xref linkend="guc-recovery-init-sync-method"/> for information about the caveats to be aware of when using <literal>syncfs</literal>. Linuxでは、syncfsを代わりに使用して、バックアップディレクトリを含むファイルシステム全体を同期するようにオペレーティングシステムに要求できます。 plain形式を使用する場合、pg_combinebackupはWALファイルと各テーブル空間を含むファイルシステムも同期させます。 syncfsを使用する際に注意すべき注意事項については、recovery_init_sync_methodを参照してください。

This option has no effect when <option>&#45;-no-sync</option> is used. このオプションは--no-syncが使われている場合は効果がありません。

-V
--version

Prints the <application>pg_combinebackup</application> version and exits. pg_combinebackupのバージョンを出力して終了します。

-?
--help

Shows help about <application>pg_combinebackup</application> command line arguments, and exits. pg_combinebackupコマンドライン引数についてのヘルプを表示して終了します。

制限事項

<title>Limitations</title>

<literal>pg_combinebackup</literal> does not recompute page checksums when writing the output directory. Therefore, if any of the backups used for reconstruction were taken with checksums disabled, but the final backup was taken with checksums enabled, the resulting directory may contain pages with invalid checksums. pg_combinebackupは出力ディレクトリを書き込む際にページチェックサムを再計算しません。 したがって、再構築に使用されたバックアップのいずれかがチェックサム無効で取得され、最終バックアップがチェックサム有効で取得された場合、結果のディレクトリは無効なチェックサムを持つページを含む可能性があります。

To avoid this problem, taking a new full backup after changing the checksum state of the cluster using <xref linkend="app-pgchecksums "/> is recommended. Otherwise, you can disable and then optionally reenable checksums on the directory produced by <literal>pg_combinebackup</literal> in order to correct the problem. この問題を回避するには、pg_checksumsを使用してクラスタのチェックサム状態を変更した後に新しいフルバックアップを取ることをお勧めします。 別な方法としては、問題を修正するためにpg_combinebackupによって生成されたディレクトリのチェックサムを無効にした後、必要に応じて再度有効にすることができます。

環境

<title>Environment</title>

This utility, like most other <productname>PostgreSQL</productname> utilities, uses the environment variables supported by <application>libpq</application> (see <xref linkend="libpq-envars"/>). このユーティリティは、他のほとんどのPostgreSQLユーティリティと同様、libpqでサポートされる環境変数を使用します(32.15を参照してください)。

The environment variable <envar>PG_COLOR</envar> specifies whether to use color in diagnostic messages. Possible values are <literal>always</literal>, <literal>auto</literal> and <literal>never</literal>. 環境変数PG_COLORは診断メッセージで色を使うかどうかを指定します。 指定可能な値はalwaysautoneverです。

関連項目

<title>See Also</title> pg_basebackup