Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit163edee

Browse files
committed
Improve discussion of consistent-snapshot backup technique. Haphazard
editing of this text had left nearly contradictory statements inadjacent paragraphs ...
1 parentb195c10 commit163edee

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

‎doc/src/sgml/backup.sgml

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/backup.sgml,v 2.33 2004/01/11 05:46:58 neilc Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/backup.sgml,v 2.34 2004/01/19 20:12:30 tgl Exp $
33
-->
44
<chapter id="backup">
55
<title>Backup and Restore</title>
@@ -331,9 +331,7 @@ tar -cf backup.tar /usr/local/pgsql/data
331331
The database server <emphasis>must</> be shut down in order to
332332
get a usable backup. Half-way measures such as disallowing all
333333
connections will not work as there is always some buffering
334-
going on. For this reason it is also not advisable to trust file
335-
systems that claim to support <quote>consistent
336-
snapshots</quote>. Information about stopping the server can be
334+
going on. Information about stopping the server can be
337335
found in <xref linkend="postmaster-shutdown">. Needless to say
338336
that you also need to shut down the server before restoring the
339337
data.
@@ -342,8 +340,8 @@ tar -cf backup.tar /usr/local/pgsql/data
342340

343341
<listitem>
344342
<para>
345-
If you have dug into the details of the file system layout of the data you
346-
may be tempted to try to back up or restore only certain
343+
If you have dug into the details of the file system layout of the
344+
database, youmay be tempted to try to back up or restore only certain
347345
individual tables or databases from their respective files or
348346
directories. This will <emphasis>not</> work because the
349347
information contained in these files contains only half the
@@ -362,16 +360,30 @@ tar -cf backup.tar /usr/local/pgsql/data
362360
<para>
363361
An alternative file-system backup approach is to make a
364362
<quote>consistent snapshot</quote> of the data directory, if the
365-
file system supports that functionality. Such a snapshot will save
363+
file system supports that functionality (and you are willing to
364+
trust that it is implemented correctly). The typical procedure is
365+
to make a <quote>frozen snapshot</> of the volume containing the
366+
database, then copy the whole data directory (not just parts, see
367+
above) from the snapshot to a backup device, then release the frozen
368+
snapshot. This will work even while the database server is running.
369+
However, a backup created in this way saves
366370
the database files in a state where the database server was not
367371
properly shut down; therefore, when you start the database server
368-
onthis backedupdirectory, it will think the server had crashed
372+
onthe backed-updata, it will think the server had crashed
369373
and replay the WAL log. This is not a problem, just be aware of
370374
it.
371375
</para>
372376

373377
<para>
374-
Note that the file system backup will not necessarily be
378+
If your database is spread across multiple volumes (for example,
379+
data files and WAL log on different disks) there may not be any way
380+
to obtain exactly-simultaneous frozen snapshots of all the volumes.
381+
Read your filesystem documentation very carefully before trusting
382+
to the consistent-snapshot technique in such situations.
383+
</para>
384+
385+
<para>
386+
Note that a file system backup will not necessarily be
375387
smaller than an SQL dump. On the contrary, it will most likely be
376388
larger. (<application>pg_dump</application> does not need to dump
377389
the contents of indexes for example, just the commands to recreate

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp