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

pg_verifybackup

pg_verifybackup <refpurpose>verify the integrity of a base backup of a <productname>PostgreSQL</productname> cluster</refpurpose> PostgreSQLクラスタのベースバックアップの完全性を確認します

概要

pg_verifybackup [option...]

説明

<title>Description</title>

<application>pg_verifybackup</application> is used to check the integrity of a database cluster backup taken using <command>pg_basebackup</command> against a <literal>backup_manifest</literal> generated by the server at the time of the backup. The backup must be stored in the "plain" format; a "tar" format backup can be checked after extracting it. pg_verifybackupは、pg_basebackupを使って取られたデータベースクラスタバックアップの完全性を、バックアップ時にサーバで生成されたbackup_manifestと比較して確認するために使われます。 バッックアップは"plain"形式で保管されていなければなりません。"tar"形式のバックアップは展開後に確認できます。

It is important to note that the validation which is performed by <application>pg_verifybackup</application> does not and cannot include every check which will be performed by a running server when attempting to make use of the backup. Even if you use this tool, you should still perform test restores and verify that the resulting databases work as expected and that they appear to contain the correct data. However, <application>pg_verifybackup</application> can detect many problems that commonly occur due to storage problems or user error. pg_verifybackupにより実行される検証は、バックアップを利用しようとしている動作中のサーバにより実行される検査をすべて含む訳ではありませんし、含むことができる訳でもないことに注意するのは重要です。 このツールを使ったとしても、テストリストアを実行したり、結果のデータベースが期待した通りに動作し、正しいデータを含んでいるように見えることを検証したりすべきです。 しかしながら、pg_verifybackupは、ストレージの問題や利用者のエラーによる多くの問題を検出できます。

Backup verification proceeds in four stages. First, <literal>pg_verifybackup</literal> reads the <literal>backup_manifest</literal> file. If that file does not exist, cannot be read, is malformed, or fails verification against its own internal checksum, <literal>pg_verifybackup</literal> will terminate with a fatal error. バックアップの検証は4つの段階を経て進みます。 第1に、pg_verifybackupbackup_manifestファイルを読みます。 そのファイルが存在しない、読むことができない、不正である、または、自身の内部チェックサムの検証に失敗した場合には、pg_verifybackupは致命的なエラーで終了します。

Second, <literal>pg_verifybackup</literal> will attempt to verify that the data files currently stored on disk are exactly the same as the data files which the server intended to send, with some exceptions that are described below. Extra and missing files will be detected, with a few exceptions. This step will ignore the presence or absence of, or any modifications to, <literal>postgresql.auto.conf</literal>, <literal>standby.signal</literal>, and <literal>recovery.signal</literal>, because it is expected that these files may have been created or modified as part of the process of taking the backup. It also won't complain about a <literal>backup_manifest</literal> file in the target directory or about anything inside <literal>pg_wal</literal>, even though these files won't be listed in the backup manifest. Only files are checked; the presence or absence of directories is not verified, except indirectly: if a directory is missing, any files it should have contained will necessarily also be missing. 第2に、pg_verifybackupは、以下に記すようないくつかの例外を除いて、ディスクに保管されているデータファイルがサーバの送ろうと意図したデータファイルと完全に同一かを検証します。 2、3の例外では、余分な、もしくは、失われたファイルが検出されます。 この段階ではpostgresql.auto.confstandby.signalrecovery.signalの存在、欠如、修正は無視されます。なぜなら、バックアップを取る過程の一部として、このファイルは作成されていたり、修正されていたりすることが予想されるからです。 また、たとえそのファイルがバックアップマニフェストの一覧に載っていたとしても、対象ディレクトリ内のbackup_manifestファイルやpg_wal内のものについて問題視しません。 ファイルだけが検査されます。ディレクトリの存在や欠如は、ディレクトリがなければ、そこに含まれるはずのファイルも必ずないという間接的なものを除き検証されません。

Next, <literal>pg_verifybackup</literal> will checksum all the files, compare the checksums against the values in the manifest, and emit errors for any files for which the computed checksum does not match the checksum stored in the manifest. This step is not performed for any files which produced errors in the previous step, since they are already known to have problems. Files which were ignored in the previous step are also ignored in this step. 次に、pg_verifybackupは、すべてのファイルのチェックサムを取り、そのチェックサムをマニフェスト内の値と比較し、計算されたチェックサムがマニフェストに保管されたチェックサムと一致しないファイルに対してエラーを出力します。 この段階は、前の段階でエラーとなったファイルに対しては実行されません。既に問題があると分かっているからです。 前の段階で無視されたファイルは、この段階でも無視されます。

Finally, <literal>pg_verifybackup</literal> will use the manifest to verify that the write-ahead log records which will be needed to recover the backup are present and that they can be read and parsed. The <literal>backup_manifest</literal> contains information about which write-ahead log records will be needed, and <literal>pg_verifybackup</literal> will use that information to invoke <literal>pg_waldump</literal> to parse those write-ahead log records. The <literal>&#45;-quiet</literal> flag will be used, so that <literal>pg_waldump</literal> will only report errors, without producing any other output. While this level of verification is sufficient to detect obvious problems such as a missing file or one whose internal checksums do not match, they aren't extensive enough to detect every possible problem that might occur when attempting to recover. For instance, a server bug that produces write-ahead log records that have the correct checksums but specify nonsensical actions can't be detected by this method. 最後にpg_verifybackupは、マニフェストを使って、バックアップを回復するのに必要な先行書き込みログレコードが存在し、それが読み込めて解析できるかを検証します。 backup_manifestは、必要となる先行書き込みログレコードに関する情報を含んでおり、pg_verifybackupは、その情報を使って、先行書き込みログレコードを解析するようpg_waldumpを呼び出します。 pg_waldumpがエラーだけを報告し、それ以外の出力をしないよう--quietフラグが使われます。 この水準の検証は、存在しないファイルや内部チェックサムが一致しないなどの明らかな問題を検出するには十分ですが、回復しようとする時に起こりうる問題をすべて検出するほど広範囲に十分なものではありません。 例えば、正しいチェックサムを持つものの馬鹿げた動作を指定する先行書き込みログレコードを生成するサーバのバグは、この方法では検出できません。

Note that if extra WAL files which are not required to recover the backup are present, they will not be checked by this tool, although a separate invocation of <literal>pg_waldump</literal> could be used for that purpose. Also note that WAL verification is version-specific: you must use the version of <literal>pg_verifybackup</literal>, and thus of <literal>pg_waldump</literal>, which pertains to the backup being checked. In contrast, the data file integrity checks should work with any version of the server that generates a <literal>backup_manifest</literal> file. バックアップからの回復に必要でない余分なWALが存在すると、それはこのツールでは検査されないことに注意してください。その目的のためにpg_waldumpを別に呼び出して使うことはできます。 また、WALの検証はバージョン固有のものだということにも注意してください。検査するバックアップに付属したバージョンのpg_verifybackupと、それゆえ、pg_waldumpも使わないとなりません。 対照的に、データファイルの完全性の検査は、backup_manifestファイルを生成したサーバのバージョンが何であれ動作します。

オプション

<title>Options</title>

<application>pg_verifybackup</application> accepts the following command-line arguments: pg_verifybackupは以下のコマンドライン引数を受け付けます。

-e
--exit-on-error

Exit as soon as a problem with the backup is detected. If this option is not specified, <literal>pg_verifybackup</literal> will continue checking the backup even after a problem has been detected, and will report all problems detected as errors. バックアップで問題が検出され次第、終了します。 このオプションが指定されていなければ、pg_verifybackupは問題が検出された後もバックアップの検査を続け、検出した問題をすべてエラーとして報告します。

-i path
--ignore=path

Ignore the specified file or directory, which should be expressed as a relative path name, when comparing the list of data files actually present in the backup to those listed in the <literal>backup_manifest</literal> file. If a directory is specified, this option affects the entire subtree rooted at that location. Complaints about extra files, missing files, file size differences, or checksum mismatches will be suppressed if the relative path name matches the specified path name. This option can be specified multiple times. バックアップ内に実際に存在するデータファイルの一覧とbackup_manifestファイル内の一覧を比較する時に、指定されたファイルやディレクトリを無視します。相対パス名で指定してください。 ディレクトリが指定された場合、このオプションは、その位置をルートとするサブツリー全体に影響します。 相対パス名が指定されたパス名に一致する場合、余分なファイル、足りないファイル、ファイルサイズの違い、チェックサムの不一致の報告は抑制されます。 このオプションは複数回指定できます。

-m path
--manifest-path=path

Use the manifest file at the specified path, rather than one located in the root of the backup directory. バックアップディレクトリのルートにあるものではなく、指定されたパスのマニフェストファイルを使用します。

-n
--no-parse-wal

Don't attempt to parse write-ahead log data that will be needed to recover from this backup. このバックアップからの回復に必要な先行書き込みログデータを解析しません。

-P
--progress

Enable progress reporting. Turning this on will deliver a progress report while verifying checksums. 進行状況のレポートを有効にします。 このオプションを有効にすると、チェックサムの検証中に進行状況をレポートします。

This option cannot be used together with the option <option>&#45;-quiet</option>. このオプションは、オプション--quietと一緒には使用できません。

-q
--quiet

Don't print anything when a backup is successfully verified. バックアップの検証に成功した場合、何も表示しません。

-s
--skip-checksums

Do not verify data file checksums. The presence or absence of files and the sizes of those files will still be checked. This is much faster, because the files themselves do not need to be read. データファイルのチェックサムを検証しません。 ファイルの存在、欠如とファイルのサイズは検査されます。 ファイル自身を読み込む必要がありませんので、これはずっと速いです。

-w path
--wal-directory=path

Try to parse WAL files stored in the specified directory, rather than in <literal>pg_wal</literal>. This may be useful if the backup is stored in a separate location from the WAL archive. pg_walではなく、指定されたディレクトリのWALファイルを解析しようとします。 バックアップがWALアーカイブとは別の場所に保管されている場合、これは有用でしょう。

Other options are also available: 他のオプションも使用可能です。

-V
--version

Print the <application>pg_verifybackup</application> version and exit. pg_verifybackupのバージョンを表示し、終了します。

-?
--help

Show help about <application>pg_verifybackup</application> command line arguments, and exit. pg_verifybackupのコマンドライン引数に関するヘルプを表示し、終了します。

<title>Examples</title>

To create a base backup of the server at <literal>mydbserver</literal> and verify the integrity of the backup: mydbserverでサーバのバックアップを作成し、バックアップの完全性を検証します。

$ pg_basebackup -h mydbserver -D /usr/local/pgsql/data
$ pg_verifybackup /usr/local/pgsql/data

To create a base backup of the server at <literal>mydbserver</literal>, move the manifest somewhere outside the backup directory, and verify the backup: mydbserverでサーバのバックアップを作成し、マニフェストをバックアップディレクトリの外のどこかに移動し、バックアップを検証します。

$ pg_basebackup -h mydbserver -D /usr/local/pgsql/backup1234
$ mv /usr/local/pgsql/backup1234/backup_manifest /my/secure/location/backup_manifest.1234
$ pg_verifybackup -m /my/secure/location/backup_manifest.1234 /usr/local/pgsql/backup1234

To verify a backup while ignoring a file that was added manually to the backup directory, and also skipping checksum verification: バックアップディレクトリに手で追加されたファイルを無視し、チェックサムの検証も省略してバックアップを検証します。

$ pg_basebackup -h mydbserver -D /usr/local/pgsql/data
$ edit /usr/local/pgsql/data/note.to.self
$ pg_verifybackup --ignore=note.to.self --skip-checksums /usr/local/pgsql/data

関連項目

<title>See Also</title> pg_basebackup