forked from docs/doc-exports
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com> Co-authored-by: Lu, Huayi <luhuayi@huawei.com> Co-committed-by: Lu, Huayi <luhuayi@huawei.com>
38 lines
8.2 KiB
HTML
38 lines
8.2 KiB
HTML
<a name="EN-US_TOPIC_0000001460722708"></a><a name="EN-US_TOPIC_0000001460722708"></a>
|
|
|
|
<h1 class="topictitle1">Archiving</h1>
|
|
<div id="body8662426"><div class="section" id="EN-US_TOPIC_0000001460722708__sb6a1fb2a738c48029115f6055de1697c"><h4 class="sectiontitle">archive_mode</h4><p id="EN-US_TOPIC_0000001460722708__ac455939699b24db4b531e357c0058a12"><strong id="EN-US_TOPIC_0000001460722708__b6814182213301">Parameter description</strong>: When <strong id="EN-US_TOPIC_0000001460722708__b4815422113013">archive_mode</strong> is enabled, completed WAL segments are sent to archive storage by setting <strong id="EN-US_TOPIC_0000001460722708__b198158227303">archive_command</strong>.</p>
|
|
<p id="EN-US_TOPIC_0000001460722708__p4873133064319"><strong id="EN-US_TOPIC_0000001460722708__b61806435279">Type</strong>: SIGHUP</p>
|
|
<p id="EN-US_TOPIC_0000001460722708__a6943a14776914cd8be05ea985153048c"><strong id="EN-US_TOPIC_0000001460722708__en-us_topic_0059778119_en-us_topic_0058967781_b26155068">Value range</strong>: Boolean</p>
|
|
<ul id="EN-US_TOPIC_0000001460722708__u8d8af26c9a75416caf77312dbfa2dc8f"><li id="EN-US_TOPIC_0000001460722708__lb005ed70fa8d4fdea2e37981943e9a1f"><strong id="EN-US_TOPIC_0000001460722708__b133428591771">on</strong>: The archiving is enabled.</li><li id="EN-US_TOPIC_0000001460722708__l92b1b0dbe464495ea942b736d482931f"><strong id="EN-US_TOPIC_0000001460722708__b169063314271">off</strong>: The archiving is disabled.</li></ul>
|
|
<p id="EN-US_TOPIC_0000001460722708__a57568322413e41c9869b6bc93b84be86"><strong id="EN-US_TOPIC_0000001460722708__b11760376277">Default value</strong>: <strong id="EN-US_TOPIC_0000001460722708__b1317633702713">off</strong></p>
|
|
<div class="notice" id="EN-US_TOPIC_0000001460722708__n29787255d3e946fea41162dd93de2a9e"><span class="noticetitle"><img src="public_sys-resources/notice_3.0-en-us.png"> </span><div class="noticebody"><p id="EN-US_TOPIC_0000001460722708__ae2c3fd01d81c4154b1edc8e1fa0a9510">When <strong id="EN-US_TOPIC_0000001460722708__b842352706134940"><a href="dws_04_0901.html#EN-US_TOPIC_0000001510402533__s9be202a993664326975a0e79a16d60c0">wal_level</a></strong> is set to <strong id="EN-US_TOPIC_0000001460722708__en-us_topic_0058967781_b494028214584">minimal</strong>, <strong id="EN-US_TOPIC_0000001460722708__b984814172811">archive_mode</strong> cannot be used.</p>
|
|
</div></div>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001460722708__s725b2c3d34e348528fafdfea55ca6a37"><h4 class="sectiontitle">archive_command</h4><p id="EN-US_TOPIC_0000001460722708__a0a5cc5a9a19149508eee2b6a198f6f76"><strong id="EN-US_TOPIC_0000001460722708__en-us_topic_0059778119_en-us_topic_0058967781_b20858051">Parameter description</strong>: Specifies the command used to archive WALs set by the administrator. You are advised to set the archive log path to an absolute path.</p>
|
|
<p id="EN-US_TOPIC_0000001460722708__p19229287486"><strong id="EN-US_TOPIC_0000001460722708__b132930444270">Type</strong>: SIGHUP</p>
|
|
<p id="EN-US_TOPIC_0000001460722708__a7f20ebb29f4f4c2d86e89ad8d51a2c0c"><strong id="EN-US_TOPIC_0000001460722708__en-us_topic_0059777791_en-us_topic_0058967586_b688672095621">Value range</strong>: a string</p>
|
|
<p id="EN-US_TOPIC_0000001460722708__aa949f2b01cec4916ae8f547abd9c1571"><strong id="EN-US_TOPIC_0000001460722708__b6529962">Default value</strong>: <strong id="EN-US_TOPIC_0000001460722708__b8423527069539">(disabled)</strong></p>
|
|
<div class="notice" id="EN-US_TOPIC_0000001460722708__nb1ba050f84aa4a45b92112eae2b86cea"><span class="noticetitle"><img src="public_sys-resources/notice_3.0-en-us.png"> </span><div class="noticebody"><ul id="EN-US_TOPIC_0000001460722708__u90906a7239614a62ae3b69f75b0e666b"><li id="EN-US_TOPIC_0000001460722708__lca57cf9ce7634afda926297de07dd884">Any <strong id="EN-US_TOPIC_0000001460722708__b84235270618838">%p</strong> in the string is replaced with the absolute path of the file to archive, and any <strong id="EN-US_TOPIC_0000001460722708__b842352706101136">%f</strong> is replaced with only the file name. (The relative path is relative to the data directory.) Use <strong id="EN-US_TOPIC_0000001460722708__b84235270618613">%%</strong> to embed an actual <strong id="EN-US_TOPIC_0000001460722708__b84235270618617">%</strong> character in the command.</li><li id="EN-US_TOPIC_0000001460722708__l92aad37ecdd841308b2a68febd18fd37">This command returns zero only if it succeeds. Example:<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001460722708__sda9d7c95cb084512a2c1807894c58996"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
|
|
<span class="normal">2</span></pre></div></td><td class="code"><div><pre><span></span><span class="n">archive_command</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'cp --remove-destination %p /mnt/server/archivedir/%f'</span><span class="w"> </span>
|
|
<span class="n">archive_command</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'copy %p /mnt/server/archivedir/%f'</span><span class="w"> </span><span class="o">#</span><span class="w"> </span><span class="n">Windows</span>
|
|
</pre></div></td></tr></table></div>
|
|
</div>
|
|
</li><li id="EN-US_TOPIC_0000001460722708__lbf7cdfd0e80a4010a8e63edfc998d4f7"><strong id="EN-US_TOPIC_0000001460722708__b84235270695044">--remove-destination</strong> indicates that files will be overwritten during the archiving.</li><li id="EN-US_TOPIC_0000001460722708__li399320563915">When <strong id="EN-US_TOPIC_0000001460722708__b17843163716221">archive_mode</strong> is set to <strong id="EN-US_TOPIC_0000001460722708__b28104612235">on</strong> or not specified, a <strong id="EN-US_TOPIC_0000001460722708__b1412663417462">backup</strong> folder will be created in the <strong id="EN-US_TOPIC_0000001460722708__b395818534461">pg_xlog</strong> directory and WALs will be compressed and copied to the <strong id="EN-US_TOPIC_0000001460722708__b88159294477">pg_xlog/backup</strong> directory.</li></ul>
|
|
</div></div>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001460722708__s6c55398cc4b546688dcff325359a4973"><h4 class="sectiontitle">archive_timeout</h4><p id="EN-US_TOPIC_0000001460722708__a5e0de7fd71614e78be01cccc2195d59e"><strong id="EN-US_TOPIC_0000001460722708__en-us_topic_0059778119_en-us_topic_0058967781_b34351291">Parameter description</strong>: Specifies the archiving period.</p>
|
|
<p id="EN-US_TOPIC_0000001460722708__p13763378482"><strong id="EN-US_TOPIC_0000001460722708__b179129446279">Type</strong>: SIGHUP</p>
|
|
<p id="EN-US_TOPIC_0000001460722708__aa7632213b0b54719a610ad6370cd0dae"><strong id="EN-US_TOPIC_0000001460722708__en-us_topic_0059778119_en-us_topic_0058967781_b21273347">Value range</strong>: an integer ranging from 0 to INT_MAX. The unit is second. <strong id="EN-US_TOPIC_0000001460722708__b182991534291">0</strong> indicates that archiving timeout is disabled.</p>
|
|
<p id="EN-US_TOPIC_0000001460722708__a6eaa65c4485b4723a715abfe5a02f01a"><strong id="EN-US_TOPIC_0000001460722708__b1116653972211">Default value</strong>: <strong id="EN-US_TOPIC_0000001460722708__b18168103952218">0</strong></p>
|
|
<div class="notice" id="EN-US_TOPIC_0000001460722708__n94aaf1734c1a4c09ab003f2fd7b7d14b"><span class="noticetitle"><img src="public_sys-resources/notice_3.0-en-us.png"> </span><div class="noticebody"><ul id="EN-US_TOPIC_0000001460722708__u94ede9c53bd5482096cdedb2518033a6"><li id="EN-US_TOPIC_0000001460722708__lcb7ef2e3489849ab888abd301e5f7781">The server is forced to switch to a new WAL segment file with the period specified by this parameter.</li><li id="EN-US_TOPIC_0000001460722708__l78f6b9547e434f76b1ac92e1f9d86a24">Archived files that are closed early due to a forced switch are still of the same length as completely full files. Therefore, a very short <strong id="EN-US_TOPIC_0000001460722708__b8371205910713">archive_timeout</strong> will bloat the archive storage. You are advised to set <strong id="EN-US_TOPIC_0000001460722708__b1137115591674">archive_timeout</strong> to <strong id="EN-US_TOPIC_0000001460722708__b842352706101938">60s</strong>.</li></ul>
|
|
</div></div>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0900.html">Write Ahead Logs</a></div>
|
|
</div>
|
|
</div>
|
|
|