repmgr configurationPrerequisites for configurationconfigurationprerequisitesconfigurationssh
Following software must be installed on both servers:
PostgreSQLrepmgr
At network level, connections between the PostgreSQL port (default: 5432)
must be possible between all nodes.
Passwordless SSH connectivity between all servers in the replication cluster
is not required, but is necessary in the following cases:
if you need &repmgr; to copy configuration files from outside the PostgreSQL
data directory (as is the case with e.g. Debian packages);
in this case rsync must also be installed on all servers.
to perform switchover operations
when executing repmgr cluster matrix
and repmgr cluster crosscheck
Consider setting ConnectTimeout to a low value in your SSH configuration.
This will make it faster to detect any SSH connection errors.
PostgreSQL configuration for &repmgr;configurationPostgreSQLPostgreSQL configuration
The following PostgreSQL configuration parameters may need to be changed in order
for &repmgr; (and replication itself) to function correctly.
hot_standbyPostgreSQL configuration
must always be set to on, as &repmgr; needs
to be able to connect to each server it manages.
Note that defaults to on from PostgreSQL 10
and later; in PostgreSQL 9.6 and earlier, the default was off.
PostgreSQL documentation: hot_standby.
wal_levelPostgreSQL configuration
must be one of or
(PostgreSQL 9.5 and earlier: one of or ).
PostgreSQL documentation: wal_level.
max_wal_sendersPostgreSQL configuration
must be set to a value of 2 or greater.
In general you will need one WAL sender for each standby which will attach to the PostgreSQL
instance; additionally &repmgr; will require two free WAL senders in order to clone further
standbys.
should be set to an appropriate value on all PostgreSQL
instances in the replication cluster which may potentially become a primary server or
(in cascading replication) the upstream server of a standby.
PostgreSQL documentation: max_wal_senders.
From PostgreSQL 12,
must be set to the same or a higher value as the primary node
(at the time the node was cloned), otherwise the standby will refuse
to start (unless is set to off, which
will prevent the node from accepting queries).
max_replication_slotsPostgreSQL configuration
If you are intending to use replication slots,
must be set to a non-zero value.
should be set to an appropriate value on all PostgreSQL
instances in the replication cluster which may potentially become a primary server or
(in cascading replication) the upstream server of a standby.
PostgreSQL documentation: max_replication_slots.
wal_log_hintsPostgreSQL configurationIf you are intending to use pg_rewind,
and the cluster was not initialised using data checksums, you may want to consider enabling
.
For more details see .
PostgreSQL documentation: wal_log_hints.
archive_modePostgreSQL configuration
We suggest setting to on (and
to /bin/true; see below)
even if you are currently not planning to use WAL file archiving.
This will make it simpler to set up WAL file archiving if it is ever required,
as changes to require a full PostgreSQL server
restart, while changes can be applied via a normal
configuration reload.
However, &repmgr; itself does not require WAL file archiving.
PostgreSQL documentation: archive_mode.
archive_commandPostgreSQL configuration
If you have set to on but are not currently planning
to use WAL file archiving, set to a command which does nothing but returns
true, such as /bin/true. See above for details.
PostgreSQL documentation: archive_command.
/ wal_keep_segmentsPostgreSQL configurationwal_keep_sizePostgreSQL configuration
Normally there is no need to set
(PostgreSQL 13 and later: wal_keep_size; default: 0),
as it is not a reliable way of ensuring that all required WAL
segments are available to standbys. Replication slots and/or an archiving solution
such as Barman are recommended to ensure standbys have a reliable
source of WAL segments at all times.
The only reason ever to set /
is you have you have configured
in repmgr.conf to include the setting --wal-method=fetch
(PostgreSQL 9.6 and earlier: --xlog-method=fetch)
and you have not set
in repmgr.conf to fetch WAL files from a reliable source such as Barman,
in which case you'll need to set
to a sufficiently high number to ensure that all WAL files required by the standby
are retained. However we do not recommend WAL retention in this way.
PostgreSQL documentation: wal_keep_segments.
See also the PostgreSQL configuration section in the
Quick-start guide.
&configuration-file;
&configuration-file-required-settings;
&configuration-file-optional-settings;
&configuration-file-log-settings;
&configuration-file-service-commands;
&configuration-permissions;
&configuration-password-management;