| The PostgreSQL 9.0 Reference Manual - Volume 3 - Server Administration Guide
by The PostgreSQL Global Development Group Paperback (6"x9"), 274 pages ISBN 9781906966072 RRP £9.95 ($14.95) Sales of this book support the PostgreSQL project! Get a printed copy>>> |
4.5.3 Archiving
archive_mode(boolean)-
When
archive_modeis enabled, completed WAL segments are sent to archive storage by settingarchive_command.archive_modeandarchive_commandare separate variables so thatarchive_commandcan be changed without leaving archiving mode. This parameter can only be set at server start.wal_levelmust be set toarchiveorhot_standbyto enablearchive_mode. archive_command(string)-
The shell command to execute to archive a completed WAL file
segment. Any
%pin the string is replaced by the path name of the file to archive, and any%fis replaced by only the file name. (The path name is relative to the working directory of the server, i.e., the cluster's data directory.) Use%%to embed an actual%character in the command. It is important for the command to return a zero exit status only if it succeeds. For more information see section 10.3.1 Setting up WAL archiving. This parameter can only be set in the ‘postgresql.conf’ file or on the server command line. It is ignored unlessarchive_modewas enabled at server start. Ifarchive_commandis an empty string (the default) whilearchive_modeis enabled, WAL archiving is temporarily disabled, but the server continues to accumulate WAL segment files in the expectation that a command will soon be provided. Settingarchive_commandto a command that does nothing but return true, e.g./bin/true(REMon Windows), effectively disables archiving, but also breaks the chain of WAL files needed for archive recovery, so it should only be used in unusual circumstances. archive_timeout(integer)-
The
archive_commandis only invoked for completed WAL segments. Hence, if your server generates little WAL traffic (or has slack periods where it does so), there could be a long delay between the completion of a transaction and its safe recording in archive storage. To limit how old unarchived data can be, you can setarchive_timeoutto force the server to switch to a new WAL segment file periodically. When this parameter is greater than zero, the server will switch to a new segment file whenever this many seconds have elapsed since the last segment file switch, and there has been any database activity, including a single checkpoint. (Increasingcheckpoint_timeoutwill reduce unnecessary checkpoints on an idle system.) Note that archived files that are closed early due to a forced switch are still the same length as completely full files. Therefore, it is unwise to use a very shortarchive_timeout---it will bloat your archive storage.archive_timeoutsettings of a minute or so are usually reasonable. This parameter can only be set in the ‘postgresql.conf’ file or on the server command line.
| ISBN 9781906966072 | The PostgreSQL 9.0 Reference Manual - Volume 3 - Server Administration Guide | See the print edition |