recovery.conf

A configuration file containing replication configuration information for standby servers or for controlling archive recovery

recovery.conf is a simple configuration file placed in the top level of the data directory which is used with standby servers to specify the location of the primary server for streaming replication, or when starting up a server using archived WAL files, or performing PITR.

recovery.conf was added in PostgreSQL 8.0 (initial commit 66ec2db7),

If a standby is promoted, recovery.conf is renamed to recovery.done.

As a file for configuring streaming replication, its name is somewhat counterintuitive, but makes sense from the historical development of PostgreSQL's replication methods. It might be an idea to think of streaming replication standbys as "permanently in recovery".

Internals

recovery.conf is processed by src/backend/access/transam/xlog.c (PostgreSQL 11 and earlier).

Note that in contrast to other directly editable configuration files, recovery.conf cannot be relocated outside of the data directory.

Replacement

From PostgreSQL 12, recovery.conf is replaced by a simple file (standby.signal) which initiates recovery, while the settings it contained have become GUC parameters; see commit 2dedf4d9.

Examples

A sample recovery.conf file is included in the source code at src/backend/access/transam/recovery.conf.sample, though it does not contain all possible parameters.

Categories

Configuration, Replication