-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharchive-recovery-settings.html
More file actions
132 lines (132 loc) · 14.3 KB
/
archive-recovery-settings.html
File metadata and controls
132 lines (132 loc) · 14.3 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
<?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>27.1. アーカイブリカバリの設定</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 V1.79.1" /><link rel="prev" href="recovery-config.html" title="第27章 リカバリの設定" /><link rel="next" href="recovery-target-settings.html" title="27.2. リカバリ対象の設定" /><meta name="viewport" content="width=device-width,initial-scale=1.0" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="4" align="center"><a accesskey="h" href="index.html">PostgreSQL 11.5文書</a></th></tr><tr><td width="10%" align="left"></td><td width="10%" align="left"></td><td width="60%" align="center"><a href="recovery-config.html" title="第27章 リカバリの設定">第27章 リカバリの設定</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?title=version 11.5 archive-recovery-settings.html">誤訳等の報告
</a></div></td></tr><tr><td width="10%" align="left"><a accesskey="p" href="recovery-config.html" title="第27章 リカバリの設定">前へ</a> </td><td width="10%" align="left"><a accesskey="u" href="recovery-config.html" title="第27章 リカバリの設定">上へ</a></td><td width="60%" align="center">27.1. アーカイブリカバリの設定</td><td width="20%" align="right"> <a accesskey="n" href="recovery-target-settings.html" title="27.2. リカバリ対象の設定">次へ</a></td></tr></table><hr /></div><div class="sect1" id="ARCHIVE-RECOVERY-SETTINGS"><div class="titlepage"><div><div><h2 class="title" style="clear: both">27.1. アーカイブリカバリの設定</h2></div></div></div><span class="original">
<title>Archive Recovery Settings</title>
</span><div class="variablelist"><dl class="variablelist"><dt id="RESTORE-COMMAND"><span class="term"><code class="varname">restore_command</code> (<code class="type">string</code>)
<a id="id-1.6.14.6.2.1.1.3" class="indexterm"></a>
</span></dt><dd><p>
<span class="original">
The local shell command to execute to retrieve an archived segment of
the WAL file series. This parameter is required for archive recovery,
but optional for streaming replication.
Any <literal>%f</literal> in the string is
replaced by the name of the file to retrieve from the archive,
and any <literal>%p</literal> is replaced by the copy destination path name
on the server.
(The path name is relative to the current working directory,
i.e., the cluster's data directory.)
Any <literal>%r</literal> is replaced by the name of the file containing the
last valid restart point. That is the earliest file that must be kept
to allow a restore to be restartable, so this information can be used
to truncate the archive to just the minimum required to support
restarting from the current restore. <literal>%r</literal> is typically only
used by warm-standby configurations
(see <xref linkend="warm-standby"/>).
Write <literal>%%</literal> to embed an actual <literal>%</literal> character.
</span>
連続したWALファイル断片のアーカイブを取得するために実行するシェルコマンドを指定します。
このパラメータはアーカイブリカバリには必須ですが、ストリーミングレプリケーションの場合には必須ではありません。
指定した文字列の中の <code class="literal">%f</code> はアーカイブから取得するファイル名に置換され、<code class="literal">%p</code> はコピー先サーバのディレクトリパス名に置換されます。
(パス名は、カレントワーキングディレクトリから検索されます。つまりクラスタのデータディレクトリです。)
<code class="literal">%r</code> は、有効な最後のリスタートポイントを含むファイル名に置換されます。
これはリスタートを可能にするためのリストア時に必要とされる、保持されているべきもっとも古いファイルとなります。
よってこの情報は、現在のリストアからリスタートするために必要となるように、アーカイブを最小化するために利用することができます。
<code class="literal">%r</code> は通常はウォームスタンバイの設定でのみ使用されます (<a class="xref" href="warm-standby.html" title="26.2. ログシッピングスタンバイサーバ">26.2</a>を参照) 。
<code class="literal">%</code> 文字を埋め込むためには、<code class="literal">%%</code> と記述してください。
</p><p>
<span class="original">
It is important for the command to return a zero exit status
only if it succeeds. The command <emphasis>will</emphasis> be asked for file
names that are not present in the archive; it must return nonzero
when so asked. Examples:
<programlisting>
restore_command = 'cp /mnt/server/archivedir/%f "%p"'
restore_command = 'copy "C:\\server\\archivedir\\%f" "%p"' # Windows
</programlisting>
An exception is that if the command was terminated by a signal (other
than <systemitem>SIGTERM</systemitem>, which is used as part of a
database server shutdown) or an error by the shell (such as command
not found), then recovery will abort and the server will not start up.
</span>
コマンドは、成功した時のみ終了コードのゼロを返却することが重要です。
このコマンドは、アーカイブに存在しないファイル名を求める<span class="emphasis"><em>ことがあります</em></span>。
その場合には、非ゼロの値を返却しなければなりません。以下に例を示します。
</p><pre class="programlisting">
restore_command = 'cp /mnt/server/archivedir/%f "%p"'
restore_command = 'copy "C:\\server\\archivedir\\%f" "%p"' # Windows
</pre><p>
例外は、データベースサーバのシャットダウンの一部として、<span class="systemitem">SIGTERM</span>以外のシグナルでコマンドが終了させられたり、シェルによってエラーが発生した(コマンドが見つからない場合など)場合で、その場合はリカバリは中断され、サーバはスタートアップしなくなります。
</p></dd><dt id="ARCHIVE-CLEANUP-COMMAND"><span class="term"><code class="varname">archive_cleanup_command</code> (<code class="type">string</code>)
<a id="id-1.6.14.6.2.2.1.3" class="indexterm"></a>
</span></dt><dd><p>
<span class="original">
This optional parameter specifies a shell command that will be executed
at every restartpoint. The purpose of
<varname>archive_cleanup_command</varname> is to provide a mechanism for
cleaning up old archived WAL files that are no longer needed by the
standby server.
Any <literal>%r</literal> is replaced by the name of the file containing the
last valid restart point.
That is the earliest file that must be <emphasis>kept</emphasis> to allow a
restore to be restartable, and so all files earlier than <literal>%r</literal>
may be safely removed.
This information can be used to truncate the archive to just the
minimum required to support restart from the current restore.
The <xref linkend="pgarchivecleanup"/> module
is often used in <varname>archive_cleanup_command</varname> for
single-standby configurations, for example:
<programlisting>archive_cleanup_command = 'pg_archivecleanup /mnt/server/archivedir %r'</programlisting>
Note however that if multiple standby servers are restoring from the
same archive directory, you will need to ensure that you do not delete
WAL files until they are no longer needed by any of the servers.
<varname>archive_cleanup_command</varname> would typically be used in a
warm-standby configuration (see <xref linkend="warm-standby"/>).
Write <literal>%%</literal> to embed an actual <literal>%</literal> character in the
command.
</span>
このオプションのパラメータは、すべてのリスタートポイントで実行されるシェルコマンドを指定します。
<code class="varname">archive_cleanup_command</code>の目的は、スタンバイサーバにとって必要とされない古いアーカイブWALファイルをクリーンアップする仕組みを提供することです。
<code class="literal">%r</code>は、最後の有効なリスタートポイントを含んでいるWALファイルのファイル名に置換されます。
これはリスタートを可能にするためのリストア時に必要とされる、保持されているべきもっとも古いファイルとなり、これによって<code class="literal">%r</code>より前のすべてのファイルは安全に削除されます。
この情報は、現在のリストアからリスタートするために必要となるように、アーカイブを最小化するために利用することができます。
<a class="xref" href="pgarchivecleanup.html" title="pg_archivecleanup"><span class="refentrytitle"><span class="application">pg_archivecleanup</span></span></a>モジュールは、単独のスタンバイ構成で<code class="varname">archive_cleanup_command</code>によく使用されます。
例:
</p><pre class="programlisting">archive_cleanup_command = 'pg_archivecleanup /mnt/server/archivedir %r'</pre><p>
但し、複数のスタンバイサーバが同一のアーカイブディレクトリからリストアしている場合には、どのサーバからも必要とされなくなるまで削除しないことを担保しなければなりません。
通常、<code class="literal">archive_cleanup_command</code> はウォームスタンバイの設定でのみ使用されます(<a class="xref" href="warm-standby.html" title="26.2. ログシッピングスタンバイサーバ">26.2</a>を参照)。
<code class="literal">%</code>文字を埋め込むためには、<code class="literal">%%</code>と記述してください。
</p><p>
<span class="original">
If the command returns a nonzero exit status then a warning log
message will be written. An exception is that if the command was
terminated by a signal or an error by the shell (such as command not
found), a fatal error will be raised.
</span>
コマンドが非ゼロの終了ステータスを返した場合、警告ログメッセージが出力されます。
例外は、コマンドがシグナルによって終了させられたか、シェルによってエラーが発生した(そのようなコマンドは見つからない)場合で、その場合は致命的エラーが発生します。
</p></dd><dt id="RECOVERY-END-COMMAND"><span class="term"><code class="varname">recovery_end_command</code> (<code class="type">string</code>)
<a id="id-1.6.14.6.2.3.1.3" class="indexterm"></a>
</span></dt><dd><p>
<span class="original">
This parameter specifies a shell command that will be executed once only
at the end of recovery. This parameter is optional. The purpose of the
<varname>recovery_end_command</varname> is to provide a mechanism for cleanup
following replication or recovery.
Any <literal>%r</literal> is replaced by the name of the file containing the
last valid restart point, like in <xref linkend="archive-cleanup-command"/>.
</span>
このパラメータは、リカバリの終了時に一度だけ実行されるシェルコマンドを指定します。
このパラメータは必須ではありません。
<code class="varname">recovery_end_command</code> の目的は、レプリケーションやリカバリ実行後のクリーンアップのメカニズムを提供することです。
<a class="xref" href="archive-recovery-settings.html#ARCHIVE-CLEANUP-COMMAND">archive_cleanup_command</a> と同様に、<code class="literal">%r</code> は有効な最後のリスタートポイントを含むファイル名に置換されます。
</p><p>
<span class="original">
If the command returns a nonzero exit status then a warning log
message will be written and the database will proceed to start up
anyway. An exception is that if the command was terminated by a
signal or an error by the shell (such as command not found), the
database will not proceed with startup.
</span>
コマンドが非ゼロの終了ステータスを返した場合、警告ログメッセージが出力されますが、データベースはスタートアップ処理を続けます。
例外は、コマンドがシグナルによって終了させられたか、シェルによってエラーが発生した(そのようなコマンドは見つからない)場合で、その場合はデータベースはスタートアップ処理を継続させません。
</p></dd></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="recovery-config.html">前へ</a> </td><td width="20%" align="center"><a accesskey="u" href="recovery-config.html">上へ</a></td><td width="40%" align="right"> <a accesskey="n" href="recovery-target-settings.html">次へ</a></td></tr><tr><td width="40%" align="left" valign="top">第27章 リカバリの設定 </td><td width="20%" align="center"><a accesskey="h" href="index.html">ホーム</a></td><td width="40%" align="right" valign="top"> 27.2. リカバリ対象の設定</td></tr></table></div></body></html>