forked from docs/doc-exports
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com> Co-authored-by: Lu, Huayi <luhuayi@huawei.com> Co-committed-by: Lu, Huayi <luhuayi@huawei.com>
46 lines
10 KiB
HTML
46 lines
10 KiB
HTML
<a name="EN-US_TOPIC_0000001145694499"></a><a name="EN-US_TOPIC_0000001145694499"></a>
|
||
|
||
<h1 class="topictitle1">Archiving</h1>
|
||
<div id="body8662426"><div class="section" id="EN-US_TOPIC_0000001145694499__sb6a1fb2a738c48029115f6055de1697c"><h4 class="sectiontitle">archive_mode</h4><p id="EN-US_TOPIC_0000001145694499__ac455939699b24db4b531e357c0058a12"><strong id="EN-US_TOPIC_0000001145694499__b13101324151219">Parameter description</strong>: When <strong id="EN-US_TOPIC_0000001145694499__b16392135612120">archive_mode</strong> is enabled, completed WAL segments are sent to archive storage by setting <strong id="EN-US_TOPIC_0000001145694499__b556562131313">archive_command</strong>.</p>
|
||
<p id="EN-US_TOPIC_0000001145694499__p4873133064319"><strong id="EN-US_TOPIC_0000001145694499__b61806435279">Type</strong>: SIGHUP</p>
|
||
<p id="EN-US_TOPIC_0000001145694499__a6943a14776914cd8be05ea985153048c"><strong id="EN-US_TOPIC_0000001145694499__en-us_topic_0059778119_en-us_topic_0058967781_b26155068">Value range</strong>: Boolean</p>
|
||
<ul id="EN-US_TOPIC_0000001145694499__u8d8af26c9a75416caf77312dbfa2dc8f"><li id="EN-US_TOPIC_0000001145694499__lb005ed70fa8d4fdea2e37981943e9a1f"><strong id="EN-US_TOPIC_0000001145694499__b133428591771">on</strong>: The archiving is enabled.</li><li id="EN-US_TOPIC_0000001145694499__l92b1b0dbe464495ea942b736d482931f"><strong id="EN-US_TOPIC_0000001145694499__b169063314271">off</strong>: The archiving is disabled.</li></ul>
|
||
<p id="EN-US_TOPIC_0000001145694499__a57568322413e41c9869b6bc93b84be86"><strong id="EN-US_TOPIC_0000001145694499__b11760376277">Default value</strong>: <strong id="EN-US_TOPIC_0000001145694499__b1317633702713">off</strong></p>
|
||
<div class="notice" id="EN-US_TOPIC_0000001145694499__n29787255d3e946fea41162dd93de2a9e"><span class="noticetitle"><img src="public_sys-resources/notice_3.0-en-us.png"> </span><div class="noticebody"><p id="EN-US_TOPIC_0000001145694499__ae2c3fd01d81c4154b1edc8e1fa0a9510">When <strong id="EN-US_TOPIC_0000001145694499__b842352706134940"><a href="dws_04_0901.html#EN-US_TOPIC_0000001145694909__s9be202a993664326975a0e79a16d60c0">wal_level</a></strong> is set to <strong id="EN-US_TOPIC_0000001145694499__en-us_topic_0058967781_b494028214584">minimal</strong>, <strong id="EN-US_TOPIC_0000001145694499__b984814172811">archive_mode</strong> cannot be used.</p>
|
||
</div></div>
|
||
</div>
|
||
<div class="section" id="EN-US_TOPIC_0000001145694499__s725b2c3d34e348528fafdfea55ca6a37"><h4 class="sectiontitle">archive_command</h4><p id="EN-US_TOPIC_0000001145694499__a0a5cc5a9a19149508eee2b6a198f6f76"><strong id="EN-US_TOPIC_0000001145694499__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_0000001145694499__p19229287486"><strong id="EN-US_TOPIC_0000001145694499__b132930444270">Type</strong>: SIGHUP</p>
|
||
<p id="EN-US_TOPIC_0000001145694499__a7f20ebb29f4f4c2d86e89ad8d51a2c0c"><strong id="EN-US_TOPIC_0000001145694499__en-us_topic_0059777791_en-us_topic_0058967586_b688672095621">Value range</strong>: a string</p>
|
||
<p id="EN-US_TOPIC_0000001145694499__aa949f2b01cec4916ae8f547abd9c1571"><strong id="EN-US_TOPIC_0000001145694499__b6529962">Default value</strong>: <strong id="EN-US_TOPIC_0000001145694499__b8423527069539">(disabled)</strong></p>
|
||
<div class="notice" id="EN-US_TOPIC_0000001145694499__nb1ba050f84aa4a45b92112eae2b86cea"><span class="noticetitle"><img src="public_sys-resources/notice_3.0-en-us.png"> </span><div class="noticebody"><ul id="EN-US_TOPIC_0000001145694499__u90906a7239614a62ae3b69f75b0e666b"><li id="EN-US_TOPIC_0000001145694499__lca57cf9ce7634afda926297de07dd884">Any <strong id="EN-US_TOPIC_0000001145694499__b84235270618838">%p</strong> in the string is replaced with the absolute path of the file to archive, and any <strong id="EN-US_TOPIC_0000001145694499__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_0000001145694499__b84235270618613">%%</strong> to embed an actual <strong id="EN-US_TOPIC_0000001145694499__b84235270618617">%</strong> character in the command.</li><li id="EN-US_TOPIC_0000001145694499__l92aad37ecdd841308b2a68febd18fd37">This command returns zero only if it succeeds. Example:<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001145694499__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><span class="w"></span>
|
||
</pre></div></td></tr></table></div>
|
||
|
||
</div>
|
||
</li><li id="EN-US_TOPIC_0000001145694499__lbf7cdfd0e80a4010a8e63edfc998d4f7"><strong id="EN-US_TOPIC_0000001145694499__b84235270695044">--remove-destination</strong> indicates that files will be overwritten during the archiving.</li><li id="EN-US_TOPIC_0000001145694499__li399320563915">When <strong id="EN-US_TOPIC_0000001145694499__b17843163716221">archive_mode</strong> is set to <strong id="EN-US_TOPIC_0000001145694499__b28104612235">on</strong> or not specified, a <strong id="EN-US_TOPIC_0000001145694499__b1412663417462">backup</strong> folder will be created in the <strong id="EN-US_TOPIC_0000001145694499__b395818534461">pg_xlog</strong> directory and WALs will be compressed and copied to the <strong id="EN-US_TOPIC_0000001145694499__b88159294477">pg_xlog/backup</strong> directory.</li></ul>
|
||
</div></div>
|
||
</div>
|
||
<div class="section" id="EN-US_TOPIC_0000001145694499__section114321834131418"><h4 class="sectiontitle">max_xlog_backup_size</h4><p id="EN-US_TOPIC_0000001145694499__p170016302143"><strong id="EN-US_TOPIC_0000001145694499__b599163324812">Parameter description</strong>: Specifies the size of WAL logs backed up in the <strong id="EN-US_TOPIC_0000001145694499__b583075018488">pg_xlog/backup</strong> directory.</p>
|
||
<p id="EN-US_TOPIC_0000001145694499__p16700930111414"><strong id="EN-US_TOPIC_0000001145694499__b1571445104815">Type</strong>: SIGHUP</p>
|
||
<p id="EN-US_TOPIC_0000001145694499__p11700193010146"><strong id="EN-US_TOPIC_0000001145694499__b22903310576">Value range</strong>: an integer between <strong id="EN-US_TOPIC_0000001145694499__b19775345717">1048576</strong> and <strong id="EN-US_TOPIC_0000001145694499__b201441356185719">104857600</strong>. The unit is KB.</p>
|
||
<p id="EN-US_TOPIC_0000001145694499__p470053041418"><strong id="EN-US_TOPIC_0000001145694499__b842352706201412">Default value</strong>: 2097152</p>
|
||
<div class="notice" id="EN-US_TOPIC_0000001145694499__note147001930151411"><span class="noticetitle"><img src="public_sys-resources/notice_3.0-en-us.png"> </span><div class="noticebody"><ul id="EN-US_TOPIC_0000001145694499__ul1570093010143"><li id="EN-US_TOPIC_0000001145694499__li127003306142">The <strong id="EN-US_TOPIC_0000001145694499__b1923062284919">max_xlog_backup_size</strong> parameter setting takes effect only when <strong id="EN-US_TOPIC_0000001145694499__b2047717368496">archive_mode</strong> is enabled and <strong id="EN-US_TOPIC_0000001145694499__b1059717437495">archive_command</strong> is set to <strong id="EN-US_TOPIC_0000001145694499__b12586175184912">NULL</strong>.</li><li id="EN-US_TOPIC_0000001145694499__li13700183031416">The system checks the size of backup WALs in the <strong id="EN-US_TOPIC_0000001145694499__b58651410185610">pg_xlog/backup</strong> directory every minute. If the size exceeds the value specified by <strong id="EN-US_TOPIC_0000001145694499__b91991628195618">max_xlog_backup_size</strong>, the system deletes the earliest backup WALs until the size is less than the <strong id="EN-US_TOPIC_0000001145694499__b13479053185615">max_xlog_backup_size</strong> value × 0.9.</li></ul>
|
||
</div></div>
|
||
</div>
|
||
<div class="section" id="EN-US_TOPIC_0000001145694499__s6c55398cc4b546688dcff325359a4973"><h4 class="sectiontitle">archive_timeout</h4><p id="EN-US_TOPIC_0000001145694499__a5e0de7fd71614e78be01cccc2195d59e"><strong id="EN-US_TOPIC_0000001145694499__en-us_topic_0059778119_en-us_topic_0058967781_b34351291">Parameter description</strong>: Specifies the archiving period.</p>
|
||
<p id="EN-US_TOPIC_0000001145694499__p13763378482"><strong id="EN-US_TOPIC_0000001145694499__b179129446279">Type</strong>: SIGHUP</p>
|
||
<p id="EN-US_TOPIC_0000001145694499__aa7632213b0b54719a610ad6370cd0dae"><strong id="EN-US_TOPIC_0000001145694499__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_0000001145694499__b182991534291">0</strong> indicates that archiving timeout is disabled.</p>
|
||
<p id="EN-US_TOPIC_0000001145694499__a6eaa65c4485b4723a715abfe5a02f01a"><strong id="EN-US_TOPIC_0000001145694499__b1116653972211">Default value</strong>: <strong id="EN-US_TOPIC_0000001145694499__b18168103952218">0</strong></p>
|
||
<div class="notice" id="EN-US_TOPIC_0000001145694499__n94aaf1734c1a4c09ab003f2fd7b7d14b"><span class="noticetitle"><img src="public_sys-resources/notice_3.0-en-us.png"> </span><div class="noticebody"><ul id="EN-US_TOPIC_0000001145694499__u94ede9c53bd5482096cdedb2518033a6"><li id="EN-US_TOPIC_0000001145694499__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_0000001145694499__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_0000001145694499__b8371205910713">archive_timeout</strong> will bloat the archive storage. You are advised to set <strong id="EN-US_TOPIC_0000001145694499__b1137115591674">archive_timeout</strong> to <strong id="EN-US_TOPIC_0000001145694499__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>
|
||
|