Movatterモバイル変換


[0]ホーム

URL:



Facebook
Postgres Pro
Facebook
Downloads
26.1. Archive Recovery Settings
Prev UpChapter 26. Recovery ConfigurationHome Next

26.1. Archive Recovery Settings

restore_command (string)

The local shell command to execute to retrieve an archived segment of the WAL file series. This parameter is required for archive recovery, but optional for streaming replication. Any%f in the string is replaced by the name of the file to retrieve from the archive, and any%p is replaced by the copy destination path name on the server. (The path name is relative to the current working directory, i.e., the cluster's data directory.) Any%r is replaced by the name of the file containing the last valid restart point. That is the earliest file that must be kept to allow a restore to be restartable, so this information can be used to truncate the archive to just the minimum required to support restarting from the current restore.%r is typically only used by warm-standby configurations (seeSection 25.2). Write%% to embed an actual% character.

It is important for the command to return a zero exit status only if it succeeds. The commandwill be asked for file names that are not present in the archive; it must return nonzero when so asked. Examples:

restore_command = 'cp /mnt/server/archivedir/%f "%p"'restore_command = 'copy "C:\\server\\archivedir\\%f" "%p"'  # Windows

An exception is that if the command was terminated by a signal (other thanSIGTERM, which is used as part of a database server shutdown) or an error by the shell (such as command not found), then recovery will abort and the server will not start up.

archive_cleanup_command (string)

This optional parameter specifies a shell command that will be executed at every restartpoint. The purpose ofarchive_cleanup_command is to provide a mechanism for cleaning up old archived WAL files that are no longer needed by the standby server. Any%r is replaced by the name of the file containing the last valid restart point. That is the earliest file that must bekept to allow a restore to be restartable, and so all files earlier than%r may be safely removed. This information can be used to truncate the archive to just the minimum required to support restart from the current restore. Thepg_archivecleanup module is often used inarchive_cleanup_command for single-standby configurations, for example:

archive_cleanup_command = 'pg_archivecleanup /mnt/server/archivedir %r'

Note however that if multiple standby servers are restoring from the 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.archive_cleanup_command would typically be used in a warm-standby configuration (seeSection 25.2). Write%% to embed an actual% character in the command.

If the command returns a nonzero exit status then a warning log message will be written. An exception is that if the command was terminated by a signal or an error by the shell (such as command not found), a fatal error will be raised.

recovery_end_command (string)

This parameter specifies a shell command that will be executed once only at the end of recovery. This parameter is optional. The purpose of therecovery_end_command is to provide a mechanism for cleanup following replication or recovery. Any%r is replaced by the name of the file containing the last valid restart point, like inarchive_cleanup_command.

If the command returns a nonzero exit status then a warning log message will be written and the database will proceed to start up anyway. An exception is that if the command was terminated by a signal or an error by the shell (such as command not found), the database will not proceed with startup.


Prev Up Next
Chapter 26. Recovery Configuration Home 26.2. Recovery Target Settings
epubpdf
Go to Postgres Pro Standard 11
By continuing to browse this website, you agree to the use of cookies. Go toPrivacy Policy.

[8]ページ先頭

©2009-2025 Movatter.jp