A.22. Release 4.0.0

A.22.1. Features and improvements
A.22.2. New command line options
A.22.3. Changed command line options
A.22.4. Configuration file changes
A.22.5. repmgrd

Tue Nov 21, 2017

repmgr 4.0 is an entirely new version of repmgr, implementing repmgr as a native PostgreSQL extension, adding new and improving existing features, and making repmgr more user-friendly and intuitive to use. The new code base will make it easier to add additional functionality for future releases.

Note

With the new version, the opportunity has been taken to make some changes in the way repmgr is set up and configured. In particular changes have been made to some configuration file settings consistency for and clarity. Changes are covered in detail below

To standardise terminology, from this release primary is used to denote the read/write node in a streaming replication cluster. master is still accepted as an alias for repmgr commands (e.g. repmgr master register).

For detailed instructions on upgrading from repmgr 3.x, see Upgrading from repmgr 3.x.

A.22.1. Features and improvements

  • improved switchover: the switchover process has been improved and streamlined, speeding up the switchover process and can also instruct other standbys to follow the new primary once the switchover has completed. See Performing a switchover with repmgr for more details.

  • "--dry-run" option: many repmgr commands now provide a --dry-run option which will execute the command as far as possible without making any changes, which will enable possible issues to be identified before the intended operation is actually carried out.

  • easier upgrades: repmgr is now implemented as a native PostgreSQL extension, which means future upgrades can be carried out by installing the upgraded package and issuing ALTER EXTENSION repmgr UPDATE.

  • improved logging output: repmgr (and repmgrd) now provide more explicit logging output giving a better picture of what is going on. Where appropriate, DETAIL and HINT log lines provide additional detail and suggestions for resolving problems. Additionally, repmgrd now emits informational log lines at regular, configurable intervals to confirm that it's running correctly and which node(s) it's monitoring.

  • automatic configuration file location in packages: Many operating system packages place the repmgr configuration files in a version-specific subdirectory, e.g. /etc/repmgr/9.6/repmgr.conf; repmgr now makes it easy for package maintainers to provide a patch with the actual file location, meaning repmgr.conf does not need to be provided explicitly. This is currently the case for 2ndQuadrant-provided .deb and .rpm packages.

  • monitoring and status checks: New commands repmgr node check and repmgr node status providing information about a node's status and replication-related monitoring output.

  • node rejoin: New commands repmgr node rejoin enables a failed primary to be rejoined to a replication cluster, optionally using pg_rewind to synchronise its data, (note that pg_rewind may not be useable in some circumstances).

  • automatic failover: improved detection of node status; promotion decision based on a consensual model, with the promoted primary explicitly informing other standbys to follow it. The repmgrd daemon will continue functioning even if the monitored PostgreSQL instance is down, and resume monitoring if it reappears. Additionally, if the instance's role has changed (typically from a primary to a standby, e.g. following reintegration of a failed primary using repmgr node rejoin) repmgrd will automatically resume monitoring it as a standby.

  • new documentation: the existing documentation spread over multiple text files has been consolidated into DocBook format (as used by the main PostgreSQL project) and is now available online in HTML format.

    The DocBook files can easily be used to create versions of the documentation in other formats such as PDF.

A.22.2. New command line options

  • --dry-run: repmgr will attempt to perform the action as far as possible without making any changes to the database

  • --upstream-node-id: use to specify the upstream node the standby will connect later stream from, when cloning and registering a standby.

    This replaces the configuration file parameter upstream_node. as the upstream node is set when the standby is initially cloned, but can change over the lifetime of an installation (due to failovers, switchovers etc.) so it's pointless/confusing keeping the original value around in repmgr.conf.

A.22.3. Changed command line options

repmgr

  • --replication-user has been deprecated; it has been replaced by the configuration file option replication_user. The value (which defaults to the user provided in the conninfo string) will be stored in the repmgr metadata for use by repmgr standby clone and repmgr standby follow.

  • --recovery-min-apply-delay is now a configuration file parameter recovery_min_apply_delay, to ensure the setting does not get lost when a standby follows a new upstream.

  • --no-conninfo-password is deprecated; a password included in the environment variable PGPASSWORD will no longer be added to primary_conninfo by default; to force the inclusion of a password (not recommended), use the new configuration file parameter use_primary_conninfo_password. For details, ee section Managing passwords.

repmgrd

  • --monitoring-history is deprecated and is replaced by the configuration file option monitoring_history. This enables the setting to be changed without having to modify system service files.

A.22.4. Configuration file changes

Required settings

The following 4 parameters are mandatory in repmgr.conf:

  • node_id
  • node_name
  • conninfo
  • data_directory

Renamed settings

Some settings have been renamed for clarity and consistency:

  • node is now node_id
  • name is now node_name
  • barman_server is now barman_host
  • master_reponse_timeout is now async_query_timeout (to better indicate its purpose)

The following configuration file parameters have been renamed for consistency with other parameters (and conform to the pattern used by PostgreSQL itself, which uses the prefix log_ for logging parameters):

  • loglevel is now log_level
  • logfile is now log_file
  • logfacility is now log_facility

Removed settings

  • cluster has been removed
  • upstream_node - see note about --upstream-node-id above
  • retry_promote_interval_secsthis is now redundant due to changes in the failover/promotion mechanism; the new equivalent is primary_notification_timeout

Logging changes

  • default value for log_level is INFO rather than NOTICE.
  • new parameter log_status_interval, which causes repmgrd to emit a status log line at the specified interval

A.22.5. repmgrd

The shared library has been renamed from repmgr_funcs to repmgr, meaning shared_preload_libraries in postgresql.conf needs to be updated to the new name:

        shared_preload_libraries = 'repmgr'