mirror of
https://github.com/postgres/postgres.git
synced 2025-11-18 02:02:55 +03:00
doc: double-quote use of %f, %p, and %r in literal commands.
Path expansion might expose characters like spaces which would cause command failure, so double-quote the examples. While %f doesn't need quoting since it uses a fixed character set, it is best to be consistent. Discussion: https://postgr.es/m/aROPCQCfvKp9Htk4@momjian.us Backpatch-through: master
This commit is contained in:
@@ -627,7 +627,7 @@ tar -cf backup.tar /usr/local/pgsql/data
|
|||||||
character in the command. The simplest useful command is something
|
character in the command. The simplest useful command is something
|
||||||
like:
|
like:
|
||||||
<programlisting>
|
<programlisting>
|
||||||
archive_command = 'test ! -f /mnt/server/archivedir/%f && cp %p /mnt/server/archivedir/%f' # Unix
|
archive_command = 'test ! -f "/mnt/server/archivedir/%f" && cp "%p" "/mnt/server/archivedir/%f"' # Unix
|
||||||
archive_command = 'copy "%p" "C:\\server\\archivedir\\%f"' # Windows
|
archive_command = 'copy "%p" "C:\\server\\archivedir\\%f"' # Windows
|
||||||
</programlisting>
|
</programlisting>
|
||||||
which will copy archivable WAL segments to the directory
|
which will copy archivable WAL segments to the directory
|
||||||
@@ -1294,7 +1294,7 @@ SELECT * FROM pg_backup_stop(wait_for_archive => true);
|
|||||||
character in the command. The simplest useful command is
|
character in the command. The simplest useful command is
|
||||||
something like:
|
something like:
|
||||||
<programlisting>
|
<programlisting>
|
||||||
restore_command = 'cp /mnt/server/archivedir/%f %p'
|
restore_command = 'cp "/mnt/server/archivedir/%f" "%p"'
|
||||||
</programlisting>
|
</programlisting>
|
||||||
which will copy previously archived WAL segments from the directory
|
which will copy previously archived WAL segments from the directory
|
||||||
<filename>/mnt/server/archivedir</filename>. Of course, you can use something
|
<filename>/mnt/server/archivedir</filename>. Of course, you can use something
|
||||||
@@ -1493,11 +1493,11 @@ restore_command = 'cp /mnt/server/archivedir/%f %p'
|
|||||||
If archive storage size is a concern, you can use
|
If archive storage size is a concern, you can use
|
||||||
<application>gzip</application> to compress the archive files:
|
<application>gzip</application> to compress the archive files:
|
||||||
<programlisting>
|
<programlisting>
|
||||||
archive_command = 'gzip < %p > /mnt/server/archivedir/%f.gz'
|
archive_command = 'gzip < "%p" > "/mnt/server/archivedir/%f.gz"'
|
||||||
</programlisting>
|
</programlisting>
|
||||||
You will then need to use <application>gunzip</application> during recovery:
|
You will then need to use <application>gunzip</application> during recovery:
|
||||||
<programlisting>
|
<programlisting>
|
||||||
restore_command = 'gunzip < /mnt/server/archivedir/%f.gz > %p'
|
restore_command = 'gunzip < "/mnt/server/archivedir/%f.gz" > "%p"'
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</para>
|
</para>
|
||||||
</sect3>
|
</sect3>
|
||||||
|
|||||||
@@ -4059,7 +4059,7 @@ include_dir 'conf.d'
|
|||||||
names that are not present in the archive; it must return nonzero
|
names that are not present in the archive; it must return nonzero
|
||||||
when so asked. Examples:
|
when so asked. Examples:
|
||||||
<programlisting>
|
<programlisting>
|
||||||
restore_command = 'cp /mnt/server/archivedir/%f "%p"'
|
restore_command = 'cp "/mnt/server/archivedir/%f" "%p"'
|
||||||
restore_command = 'copy "C:\\server\\archivedir\\%f" "%p"' # Windows
|
restore_command = 'copy "C:\\server\\archivedir\\%f" "%p"' # Windows
|
||||||
</programlisting>
|
</programlisting>
|
||||||
An exception is that if the command was terminated by a signal (other
|
An exception is that if the command was terminated by a signal (other
|
||||||
@@ -4098,7 +4098,7 @@ restore_command = 'copy "C:\\server\\archivedir\\%f" "%p"' # Windows
|
|||||||
The <xref linkend="pgarchivecleanup"/> module
|
The <xref linkend="pgarchivecleanup"/> module
|
||||||
is often used in <varname>archive_cleanup_command</varname> for
|
is often used in <varname>archive_cleanup_command</varname> for
|
||||||
single-standby configurations, for example:
|
single-standby configurations, for example:
|
||||||
<programlisting>archive_cleanup_command = 'pg_archivecleanup /mnt/server/archivedir %r'</programlisting>
|
<programlisting>archive_cleanup_command = 'pg_archivecleanup /mnt/server/archivedir "%r"'</programlisting>
|
||||||
Note however that if multiple standby servers are restoring from the
|
Note however that if multiple standby servers are restoring from the
|
||||||
same archive directory, you will need to ensure that you do not delete
|
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.
|
WAL files until they are no longer needed by any of the servers.
|
||||||
|
|||||||
@@ -745,8 +745,8 @@ protocol to make nodes agree on a serializable transactional order.
|
|||||||
A simple example of configuration is:
|
A simple example of configuration is:
|
||||||
<programlisting>
|
<programlisting>
|
||||||
primary_conninfo = 'host=192.168.1.50 port=5432 user=foo password=foopass options=''-c wal_sender_timeout=5000'''
|
primary_conninfo = 'host=192.168.1.50 port=5432 user=foo password=foopass options=''-c wal_sender_timeout=5000'''
|
||||||
restore_command = 'cp /path/to/archive/%f %p'
|
restore_command = 'cp "/path/to/archive/%f" "%p"'
|
||||||
archive_cleanup_command = 'pg_archivecleanup /path/to/archive %r'
|
archive_cleanup_command = 'pg_archivecleanup /path/to/archive "%r"'
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ PostgreSQL documentation
|
|||||||
server to use <application>pg_archivecleanup</application>, put this into its
|
server to use <application>pg_archivecleanup</application>, put this into its
|
||||||
<filename>postgresql.conf</filename> configuration file:
|
<filename>postgresql.conf</filename> configuration file:
|
||||||
<programlisting>
|
<programlisting>
|
||||||
archive_cleanup_command = 'pg_archivecleanup <replaceable>archivelocation</replaceable> %r'
|
archive_cleanup_command = 'pg_archivecleanup <replaceable>archivelocation</replaceable> "%r"'
|
||||||
</programlisting>
|
</programlisting>
|
||||||
where <replaceable>archivelocation</replaceable> is the directory from which WAL segment
|
where <replaceable>archivelocation</replaceable> is the directory from which WAL segment
|
||||||
files should be removed.
|
files should be removed.
|
||||||
@@ -198,7 +198,7 @@ pg_archivecleanup: removing file "archive/00000001000000370000000E"
|
|||||||
|
|
||||||
<para>On Linux or Unix systems, you might use:
|
<para>On Linux or Unix systems, you might use:
|
||||||
<programlisting>
|
<programlisting>
|
||||||
archive_cleanup_command = 'pg_archivecleanup -d /mnt/standby/archive %r 2>>cleanup.log'
|
archive_cleanup_command = 'pg_archivecleanup -d /mnt/standby/archive "%r" 2>>cleanup.log'
|
||||||
</programlisting>
|
</programlisting>
|
||||||
where the archive directory is physically located on the standby server,
|
where the archive directory is physically located on the standby server,
|
||||||
so that the <varname>archive_command</varname> is accessing it across NFS,
|
so that the <varname>archive_command</varname> is accessing it across NFS,
|
||||||
|
|||||||
@@ -283,7 +283,7 @@
|
|||||||
#archive_command = '' # command to use to archive a WAL file
|
#archive_command = '' # command to use to archive a WAL file
|
||||||
# placeholders: %p = path of file to archive
|
# placeholders: %p = path of file to archive
|
||||||
# %f = file name only
|
# %f = file name only
|
||||||
# e.g. 'test ! -f /mnt/server/archivedir/%f && cp %p /mnt/server/archivedir/%f'
|
# e.g. 'test ! -f "/mnt/server/archivedir/%f" && cp "%p" "/mnt/server/archivedir/%f"'
|
||||||
#archive_timeout = 0 # force a WAL file switch after this
|
#archive_timeout = 0 # force a WAL file switch after this
|
||||||
# number of seconds; 0 disables
|
# number of seconds; 0 disables
|
||||||
|
|
||||||
@@ -294,7 +294,7 @@
|
|||||||
#restore_command = '' # command to use to restore an archived WAL file
|
#restore_command = '' # command to use to restore an archived WAL file
|
||||||
# placeholders: %p = path of file to restore
|
# placeholders: %p = path of file to restore
|
||||||
# %f = file name only
|
# %f = file name only
|
||||||
# e.g. 'cp /mnt/server/archivedir/%f %p'
|
# e.g. 'cp "/mnt/server/archivedir/%f" "%p"'
|
||||||
#archive_cleanup_command = '' # command to execute at every restartpoint
|
#archive_cleanup_command = '' # command to execute at every restartpoint
|
||||||
#recovery_end_command = '' # command to execute at completion of recovery
|
#recovery_end_command = '' # command to execute at completion of recovery
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user