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

Commit60bbf07

Browse files
committed
doc: Update section on NFS
The old section was ancient and didn't seem very helpful. Here, weadd some concrete advice on particular mount options.Reviewed-by: Joe Conway <mail@joeconway.com>Discussion:https://www.postgresql.org/message-id/flat/e90f24bb-5423-6abb-58ec-501176eb4afc%402ndquadrant.com
1 parent90fca7a commit60bbf07

File tree

1 file changed

+64
-31
lines changed

1 file changed

+64
-31
lines changed

‎doc/src/sgml/runtime.sgml

Lines changed: 64 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -229,42 +229,75 @@ postgres$ <userinput>initdb -D /usr/local/pgsql/data</userinput>
229229

230230
</sect2>
231231

232-
<sect2 id="creating-cluster-nfs">
233-
<title>Use of Network File Systems</title>
234-
235-
<indexterm zone="creating-cluster-nfs">
236-
<primary>Network File Systems</primary>
237-
</indexterm>
238-
<indexterm><primary><acronym>NFS</acronym></primary><see>Network File Systems</see></indexterm>
239-
<indexterm><primary>Network Attached Storage (<acronym>NAS</acronym>)</primary><see>Network File Systems</see></indexterm>
232+
<sect2 id="creating-cluster-filesystem">
233+
<title>File Systems</title>
240234

241235
<para>
242-
Many installations create their database clusters on network file
243-
systems. Sometimes this is done via <acronym>NFS</acronym>, or by using a
244-
Network Attached Storage (<acronym>NAS</acronym>) device that uses
245-
<acronym>NFS</acronym> internally. <productname>PostgreSQL</productname> does nothing
246-
special for <acronym>NFS</acronym> file systems, meaning it assumes
247-
<acronym>NFS</acronym> behaves exactly like locally-connected drives.
248-
If the client or server <acronym>NFS</acronym> implementation does not
249-
provide standard file system semantics, this can
250-
cause reliability problems (see <ulink
251-
url="https://www.time-travellers.org/shane/papers/NFS_considered_harmful.html"></ulink>).
252-
Specifically, delayed (asynchronous) writes to the <acronym>NFS</acronym>
253-
server can cause data corruption problems. If possible, mount the
254-
<acronym>NFS</acronym> file system synchronously (without caching) to avoid
255-
this hazard. Also, soft-mounting the <acronym>NFS</acronym> file system is
256-
not recommended.
236+
Generally, any file system with POSIX semantics can be used for
237+
PostgreSQL. Users prefer different file systems for a variety of reasons,
238+
including vendor support, performance, and familiarity. Experience
239+
suggests that, all other things being equal, one should not expect major
240+
performance or behavior changes merely from switching file systems or
241+
making minor file system configuration changes.
257242
</para>
258243

259-
<para>
260-
Storage Area Networks (<acronym>SAN</acronym>) typically use communication
261-
protocols other than <acronym>NFS</acronym>, and may or may not be subject
262-
to hazards of this sort. It's advisable to consult the vendor's
263-
documentation concerning data consistency guarantees.
264-
<productname>PostgreSQL</productname> cannot be more reliable than
265-
the file system it's using.
266-
</para>
244+
<sect3 id="creating-cluster-nfs">
245+
<title>NFS</title>
246+
247+
<indexterm zone="creating-cluster-nfs">
248+
<primary>NFS</primary>
249+
</indexterm>
250+
251+
<para>
252+
It is possible to use an <acronym>NFS</acronym> file system for storing
253+
the <productname>PostgreSQL</productname> data directory.
254+
<productname>PostgreSQL</productname> does nothing special for
255+
<acronym>NFS</acronym> file systems, meaning it assumes
256+
<acronym>NFS</acronym> behaves exactly like locally-connected drives.
257+
<productname>PostgreSQL</productname> does not use any functionality that
258+
is known to have nonstandard behavior on <acronym>NFS</acronym>, such as
259+
file locking.
260+
</para>
267261

262+
<para>
263+
The only firm requirement for using <acronym>NFS</acronym> with
264+
<productname>PostgreSQL</productname> is that the file system is mounted
265+
using the <literal>hard</literal> option. With the
266+
<literal>hard</literal> option, processes can <quote>hang</quote>
267+
indefinitely if there are network problems, so this configuration will
268+
require a careful monitoring setup. The <literal>soft</literal> option
269+
will interrupt system calls in case of network problems, but
270+
<productname>PostgreSQL</productname> will not repeat system calls
271+
interrupted in this way, so any such interruption will result in an I/O
272+
error being reported.
273+
</para>
274+
275+
<para>
276+
It is not necessary to use the <literal>sync</literal> mount option. The
277+
behavior of the <literal>async</literal> option is sufficient, since
278+
<productname>PostgreSQL</productname> issues <literal>fsync</literal>
279+
calls at appropriate times to flush the write caches. (This is analogous
280+
to how it works on a local file system.) However, it is strongly
281+
recommended to use the <literal>sync</literal> export option on the NFS
282+
<emphasis>server</emphasis> on systems where it exists (mainly Linux).
283+
Otherwise, an <literal>fsync</literal> or equivalent on the NFS client is
284+
not actually guaranteed to reach permanent storage on the server, which
285+
could cause corruption similar to running with the parameter <xref
286+
linkend="guc-fsync"/> off. The defaults of these mount and export
287+
options differ between vendors and versions, so it is recommended to
288+
check and perhaps specify them explicitly in any case to avoid any
289+
ambiguity.
290+
</para>
291+
292+
<para>
293+
In some cases, an external storage product can be accessed either via NFS
294+
or a lower-level protocol such as iSCSI. In the latter case, the storage
295+
appears as a block device and any available file system can be created on
296+
it. That approach might relieve the DBA from having to deal with some of
297+
the idiosyncrasies of NFS, but of course the complexity of managing
298+
remote storage then happens at other levels.
299+
</para>
300+
</sect3>
268301
</sect2>
269302

270303
</sect1>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp