-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp-pgverifybackup.html
More file actions
289 lines (286 loc) · 27.5 KB
/
app-pgverifybackup.html
File metadata and controls
289 lines (286 loc) · 27.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>pg_verifybackup</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="app-pgrestore.html" title="pg_restore" /><link rel="next" href="app-psql.html" title="psql" /><meta name="viewport" content="width=device-width,initial-scale=1.0" /></head><body id="docContent" class="container-fluid col-10"><div class="other_version"><a href="https://www.postgresql.jp/document/">バージョンごとのドキュメント一覧</a></div><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="4" align="center"><a accesskey="h" href="index.html">PostgreSQL 18.3文書</a></th></tr><tr><td width="10%" align="left"></td><td width="10%" align="left"></td><td width="60%" align="center"><a href="reference-client.html" title="PostgreSQLクライアントアプリケーション">PostgreSQLクライアントアプリケーション</a></td><td width="20%" align="right"><div class="actions"><a class="issue" title="github" href="https://github.com/pgsql-jp/jpug-doc/issues/new?template=bug_report.yml&what-happened=version 18.3 : app-pgverifybackup.html">誤訳等の報告
</a></div></td></tr><tr><td width="10%" align="left"><a accesskey="p" href="app-pgrestore.html" title="pg_restore">前へ</a> </td><td width="10%" align="left"><a accesskey="u" href="reference-client.html" title="PostgreSQLクライアントアプリケーション">上へ</a></td><td width="60%" align="center"><span class="application">pg_verifybackup</span></td><td width="20%" align="right"> <a accesskey="n" href="app-psql.html" title="psql">次へ</a></td></tr></table><hr /></div><div class="refentry" id="APP-PGVERIFYBACKUP"><div class="titlepage"></div><a id="id-1.9.4.20.1" class="indexterm"></a><div class="refnamediv"><h2><span class="refentrytitle"><span class="application">pg_verifybackup</span></span></h2><p>pg_verifybackup<span class="original">
<refpurpose>verify the integrity of a base backup of a
<productname>PostgreSQL</productname> cluster</refpurpose>
</span> — <span class="productname">PostgreSQL</span>クラスタのベースバックアップの完全性を確認する</p></div><div class="refsynopsisdiv"><h2>概要</h2><div class="cmdsynopsis"><p id="id-1.9.4.20.4.1"><code class="command">pg_verifybackup</code> [<em class="replaceable"><code>option</code></em>...]</p></div></div><div class="refsect1" id="id-1.9.4.20.5"><h2>説明</h2><span class="original">
<title>Description</title>
</span><p>
<span class="original">
<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 may be stored either in the "plain" or the "tar"
format; this includes tar-format backups compressed with any algorithm
supported by <application>pg_basebackup</application>. However, at present,
<literal>WAL</literal> verification is supported only for plain-format
backups. Therefore, if the backup is stored in tar-format, the
<literal>-n, &#45;-no-parse-wal</literal> option should be used.
</span>
<span class="application">pg_verifybackup</span>は、<code class="command">pg_basebackup</code>を使って取られたデータベースクラスタバックアップの完全性を、バックアップ時にサーバで生成された<code class="literal">backup_manifest</code>と比較して確認するために使われます。
バックアップは"plain"形式または"tar"形式で保管されているでしょう。これには<span class="application">pg_basebackup</span>でサポートされるアルゴリズムで圧縮されたtar形式バックアップが含まれます。
しかし、現時点では、<code class="literal">WAL</code>検証はplain形式バックアップに対してのみサポートされます。
したがって、バックアップがtar形式で保管されている場合は<code class="literal">-n, --no-parse-wal</code>オプションを使用することが必要です。
</p><p>
<span class="original">
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.
</span>
<span class="application">pg_verifybackup</span>により実行される検証は、バックアップを利用しようとしている動作中のサーバにより実行される検査をすべて含む訳ではありませんし、含むことができる訳でもないことに注意するのは重要です。
このツールを使ったとしても、テストリストアを実行したり、結果のデータベースが期待した通りに動作し、正しいデータを含んでいるように見えることを検証したりすべきです。
しかしながら、<span class="application">pg_verifybackup</span>は、ストレージの問題や利用者のエラーによる多くの問題を検出できます。
</p><p>
<span class="original">
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, fails to match the system
identifier with <filename>pg_control</filename> of the backup directory or
fails verification against its own internal checksum,
<literal>pg_verifybackup</literal> will terminate with a fatal error.
</span>
バックアップの検証は4つの段階で進みます。
第1に、<code class="literal">pg_verifybackup</code>が<code class="literal">backup_manifest</code>ファイルを読みます。
そのファイルが存在しない、読むことができない、不正である、バックアップディレクトリの<code class="filename">pg_control</code>とシステム識別子が一致しない、または、自身の内部チェックサムの検証に失敗した場合には、<code class="literal">pg_verifybackup</code>は致命的なエラーで終了します。
</p><p>
<span class="original">
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.
</span>
第2に、<code class="literal">pg_verifybackup</code>は、以下に記すようないくつかの例外を除いて、ディスクに保管されているデータファイルがサーバの送ろうと意図したデータファイルと完全に同一かを検証します。
2、3の例外では、余分な、もしくは、失われたファイルが検出されます。
この段階では<code class="literal">postgresql.auto.conf</code>、<code class="literal">standby.signal</code>、<code class="literal">recovery.signal</code>の存在、欠如、修正は無視されます。なぜなら、バックアップを取る過程の一部として、このファイルは作成されていたり、修正されていたりすることが予想されるからです。
また、たとえそのファイルがバックアップマニフェストの一覧に載っていたとしても、対象ディレクトリ内の<code class="literal">backup_manifest</code>ファイルや<code class="literal">pg_wal</code>内のものについて問題視しません。
ファイルだけが検査されます。ディレクトリの存在や欠如は、ディレクトリがなければ、そこに含まれるはずのファイルも必ずないという間接的なものを除き検証されません。
</p><p>
<span class="original">
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.
</span>
次に、<code class="literal">pg_verifybackup</code>は、すべてのファイルのチェックサムを取り、そのチェックサムをマニフェスト内の値と比較し、計算されたチェックサムがマニフェストに保管されたチェックサムと一致しないファイルに対してエラーを出力します。
この段階は、前の段階でエラーとなったファイルに対しては実行されません。既に問題があると分かっているからです。
前の段階で無視されたファイルは、この段階でも無視されます。
</p><p>
<span class="original">
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.
</span>
最後に<code class="literal">pg_verifybackup</code>は、マニフェストを使って、バックアップを回復するのに必要な先行書き込みログ(WAL)レコードが存在し、それが読み込めて解析できるかを検証します。
<code class="literal">backup_manifest</code>は、必要となる先行書き込みログ(WAL)レコードに関する情報を含んでおり、<code class="literal">pg_verifybackup</code>は、その情報を使って、先行書き込みログ(WAL)レコードを解析するよう<code class="literal">pg_waldump</code>を呼び出します。
<code class="literal">pg_waldump</code>がエラーだけを報告し、それ以外の出力をしないよう<code class="literal">--quiet</code>フラグが使われます。
この水準の検証は、存在しないファイルや内部チェックサムが一致しないなどの明らかな問題を検出するには十分ですが、回復しようとする時に起こりうる問題をすべて検出するほど広範囲に十分なものではありません。
例えば、正しいチェックサムを持つものの馬鹿げた動作を指定する先行書き込みログ(WAL)レコードを生成するサーバのバグは、この方法では検出できません。
</p><p>
<span class="original">
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.
</span>
バックアップからの回復に必要でない余分なWALが存在すると、それはこのツールでは検査されないことに注意してください。その目的のために<code class="literal">pg_waldump</code>を別に呼び出して使うことはできます。
また、WALの検証はバージョン固有のものだということにも注意してください。検査するバックアップに付属したバージョンの<code class="literal">pg_verifybackup</code>と、それゆえ、<code class="literal">pg_waldump</code>も使わないとなりません。
対照的に、データファイルの完全性の検査は、<code class="literal">backup_manifest</code>ファイルを生成したサーバのバージョンが何であれ動作します。
</p></div><div class="refsect1" id="id-1.9.4.20.6"><h2>オプション</h2><span class="original">
<title>Options</title>
</span><p>
<span class="original">
<application>pg_verifybackup</application> accepts the following
command-line arguments:
</span>
<span class="application">pg_verifybackup</span>は以下のコマンドライン引数を受け付けます。
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="option">-e</code><br /></span><span class="term"><code class="option">--exit-on-error</code></span></dt><dd><p>
<span class="original">
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.
</span>
バックアップで問題が検出され次第、終了します。
このオプションが指定されていなければ、<code class="literal">pg_verifybackup</code>は問題が検出された後もバックアップの検査を続け、検出した問題をすべてエラーとして報告します。
</p></dd><dt><span class="term"><code class="option">-F <em class="replaceable"><code>format</code></em></code><br /></span><span class="term"><code class="option">--format=<em class="replaceable"><code>format</code></em></code></span></dt><dd><p>
<span class="original">
Specifies the format of the backup. <replaceable>format</replaceable>
can be one of the following:
</span>
バックアップの形式を指定します。
<em class="replaceable"><code>format</code></em>には次のいずれかを指定できます。
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="literal">p</code><br /></span><span class="term"><code class="literal">plain</code></span></dt><dd><p>
<span class="original">
Backup consists of plain files with the same layout as the
source server's data directory and tablespaces.
</span>
バックアップは、ソースサーバのデータディレクトリとテーブル空間とレイアウトが同じ単純なファイルで構成されています。
</p></dd><dt><span class="term"><code class="literal">t</code><br /></span><span class="term"><code class="literal">tar</code></span></dt><dd><p>
<span class="original">
Backup consists of tar files, which may be compressed. A valid
backup includes the main data directory in a file named
<filename>base.tar</filename>, the WAL files in
<filename>pg_wal.tar</filename>, and separate tar files for
each tablespace, named after the tablespace's OID. If the backup
is compressed, the relevant compression extension is added to the
end of each file name.
</span>
バックアップはtarファイルで構成されていて、tarファイルは圧縮されているかもしれません。
有効なバックアップでは、メインデータディレクトリを格納した<code class="filename">base.tar</code>という名前のファイル、WALファイルを格納した<code class="filename">pg_wal.tar</code>、各テーブル空間ごとにそのテーブル空間のOIDを名前にした個別のtarファイルが含まれます。
バックアップが圧縮されている場合は、関連する圧縮の拡張子が各ファイル名の最後に追加されます。
</p></dd></dl></div></dd><dt><span class="term"><code class="option">-i <em class="replaceable"><code>path</code></em></code><br /></span><span class="term"><code class="option">--ignore=<em class="replaceable"><code>path</code></em></code></span></dt><dd><p>
<span class="original">
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.
</span>
バックアップ内に実際に存在するデータファイルの一覧と<code class="literal">backup_manifest</code>ファイル内の一覧を比較する時に、指定されたファイルやディレクトリを無視します。相対パス名で指定してください。
ディレクトリが指定された場合、このオプションは、その位置をルートとするサブツリー全体に影響します。
相対パス名が指定されたパス名に一致する場合、余分なファイル、足りないファイル、ファイルサイズの違い、チェックサムの不一致の報告は抑制されます。
このオプションは複数回指定できます。
</p></dd><dt><span class="term"><code class="option">-m <em class="replaceable"><code>path</code></em></code><br /></span><span class="term"><code class="option">--manifest-path=<em class="replaceable"><code>path</code></em></code></span></dt><dd><p>
<span class="original">
Use the manifest file at the specified path, rather than one located
in the root of the backup directory.
</span>
バックアップディレクトリのルートにあるものではなく、指定されたパスのマニフェストファイルを使用します。
</p></dd><dt><span class="term"><code class="option">-n</code><br /></span><span class="term"><code class="option">--no-parse-wal</code></span></dt><dd><p>
<span class="original">
Don't attempt to parse write-ahead log data that will be needed
to recover from this backup.
</span>
このバックアップからの回復に必要な先行書き込みログ(WAL)データを解析しません。
</p></dd><dt><span class="term"><code class="option">-P</code><br /></span><span class="term"><code class="option">--progress</code></span></dt><dd><p>
<span class="original">
Enable progress reporting. Turning this on will deliver a progress
report while verifying checksums.
</span>
進行状況のレポートを有効にします。
このオプションを有効にすると、チェックサムの検証中に進行状況をレポートします。
</p><p>
<span class="original">
This option cannot be used together with the option
<option>&#45;-quiet</option>.
</span>
このオプションは、オプション<code class="option">--quiet</code>と一緒には使用できません。
</p></dd><dt><span class="term"><code class="option">-q</code><br /></span><span class="term"><code class="option">--quiet</code></span></dt><dd><p>
<span class="original">
Don't print anything when a backup is successfully verified.
</span>
バックアップの検証に成功した場合、何も表示しません。
</p></dd><dt><span class="term"><code class="option">-s</code><br /></span><span class="term"><code class="option">--skip-checksums</code></span></dt><dd><p>
<span class="original">
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.
</span>
データファイルのチェックサムを検証しません。
ファイルの存在、欠如とファイルのサイズは検査されます。
ファイル自身を読み込む必要がありませんので、これはずっと速いです。
</p></dd><dt><span class="term"><code class="option">-w <em class="replaceable"><code>path</code></em></code><br /></span><span class="term"><code class="option">--wal-directory=<em class="replaceable"><code>path</code></em></code></span></dt><dd><p>
<span class="original">
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.
</span>
<code class="literal">pg_wal</code>ではなく、指定されたディレクトリのWALファイルを解析しようとします。
バックアップがWALアーカイブとは別の場所に保管されている場合、これは有用でしょう。
</p></dd></dl></div><p>
</p><p>
<span class="original">
Other options are also available:
</span>
他のオプションも使用可能です。
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="option">-V</code><br /></span><span class="term"><code class="option">--version</code></span></dt><dd><p>
<span class="original">
Print the <application>pg_verifybackup</application> version and exit.
</span>
<span class="application">pg_verifybackup</span>のバージョンを表示し、終了します。
</p></dd><dt><span class="term"><code class="option">-?</code><br /></span><span class="term"><code class="option">--help</code></span></dt><dd><p>
<span class="original">
Show help about <application>pg_verifybackup</application> command
line arguments, and exit.
</span>
<span class="application">pg_verifybackup</span>のコマンドライン引数に関するヘルプを表示し、終了します。
</p></dd></dl></div><p>
</p></div><div class="refsect1" id="id-1.9.4.20.7"><h2>例</h2><span class="original">
<title>Examples</title>
</span><p>
<span class="original">
To create a base backup of the server at <literal>mydbserver</literal> and
verify the integrity of the backup:
</span>
<code class="literal">mydbserver</code>でサーバのバックアップを作成し、バックアップの完全性を検証します。
</p><pre class="screen">
<code class="prompt">$</code> <strong class="userinput"><code>pg_basebackup -h mydbserver -D /usr/local/pgsql/data</code></strong>
<code class="prompt">$</code> <strong class="userinput"><code>pg_verifybackup /usr/local/pgsql/data</code></strong>
</pre><p>
</p><p>
<span class="original">
To create a base backup of the server at <literal>mydbserver</literal>, move
the manifest somewhere outside the backup directory, and verify the
backup:
</span>
<code class="literal">mydbserver</code>でサーバのバックアップを作成し、マニフェストをバックアップディレクトリの外のどこかに移動し、バックアップを検証します。
</p><pre class="screen">
<code class="prompt">$</code> <strong class="userinput"><code>pg_basebackup -h mydbserver -D /usr/local/pgsql/backup1234</code></strong>
<code class="prompt">$</code> <strong class="userinput"><code>mv /usr/local/pgsql/backup1234/backup_manifest /my/secure/location/backup_manifest.1234</code></strong>
<code class="prompt">$</code> <strong class="userinput"><code>pg_verifybackup -m /my/secure/location/backup_manifest.1234 /usr/local/pgsql/backup1234</code></strong>
</pre><p>
</p><p>
<span class="original">
To verify a backup while ignoring a file that was added manually to the
backup directory, and also skipping checksum verification:
</span>
バックアップディレクトリに手で追加されたファイルを無視し、チェックサムの検証も省略してバックアップを検証します。
</p><pre class="screen">
<code class="prompt">$</code> <strong class="userinput"><code>pg_basebackup -h mydbserver -D /usr/local/pgsql/data</code></strong>
<code class="prompt">$</code> <strong class="userinput"><code>edit /usr/local/pgsql/data/note.to.self</code></strong>
<code class="prompt">$</code> <strong class="userinput"><code>pg_verifybackup --ignore=note.to.self --skip-checksums /usr/local/pgsql/data</code></strong>
</pre></div><div class="refsect1" id="id-1.9.4.20.8"><h2>関連項目</h2><span class="original">
<title>See Also</title>
</span><span class="simplelist"><a class="xref" href="app-pgbasebackup.html" title="pg_basebackup"><span class="refentrytitle"><span class="application">pg_basebackup</span></span></a></span></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="app-pgrestore.html" title="pg_restore">前へ</a> </td><td width="20%" align="center"><a accesskey="u" href="reference-client.html" title="PostgreSQLクライアントアプリケーション">上へ</a></td><td width="40%" align="right"> <a accesskey="n" href="app-psql.html" title="psql">次へ</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="application">pg_restore</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 18.3文書">ホーム</a></td><td width="40%" align="right" valign="top"> <span class="application">psql</span></td></tr></table></div></body></html>