Monday, June 26

repmgr 3.3

repmgr 3.3 introduces a number of additional options for setting up and managing replication clusters, with particular emphasis on cascading replication support. These changes will also make it easier to set up complex clusters using provisioning scripts.

Additionally there are changes to the repmgr command line utility’s logging behaviour which you should take into consideration when running therepmgrd daemon.

repmgr is also tracking developments in the next major PostgreSQL release, 10.0, which will bring a lot of changes to the way PostgreSQL handles replication. At the time of writing, repmgr will work with the current PostgreSQL development code, but this combination is of course not suitable for use in production.

Changes to logging behaviour

Traditionally the repmgr command line utility and the repmgrd daemon shared the same logging configuration, which often resulted in output from repmgr command line activity being diverted to a logfile. This is of course somewhat counterintuitive for command line operations, so from this release by default repmgr will direct all output to the console (STDERR), without displaying timestamps.

Old behaviour:

$ repmgr -h repmgr_node1 -U repmgr -d repmgr -D /path/to/node2/data/ -f /etc/repmgr.conf standby clone
[2016-01-07 17:21:26] [NOTICE] destination directory '/path/to/node2/data/' provided
[2016-01-07 17:21:26] [NOTICE] starting backup...

New behaviour:

$ repmgr -h repmgr_node1 -U repmgr -d repmgr -D /path/to/node2/data/ -f /etc/repmgr.conf standby clone
NOTICE: destination directory '/path/to/node2/data/' provided
NOTICE: starting backup..

Note that if running repmgrd, you will probably still want to capture repmgr output when it’s executed by repmgrd, e.g. in a failover situation. In this case the command line option --log-to-file will restore the behaviour; add this to any repmgr invocations in yourrepmgrd configuration.

Improved control over recovery.conf generation

repmgr 3.3 provides additional control over which items are included in recovery.conf‘s primary_conninfo parameter with the following new command line options.

–replication-user

This explicitly sets the value for the user parameter in primary_conninfo. By default this will be the same as the repmgr database user, however you may wish to use a different user for the actual replication connection.

–no-conninfo-password

This prevents the database password from being stored in primary_conninfo; you’ll need to provide the password via another method such as the .pgpass file.

–upstream-conninfo

This explicitly sets the primary_conninfo string itself. This is useful when provisioning a replication cluster with cascading replication, e.g. when the standby being cloned is intended to be attached to an upstream standby which has not yet been cloned or registered, meaning the connection information is not yet available via the repmgr metadatabase. Note that this option will override `–replication-user` and `–no-conninfo-password`.

Greater flexibility when registering standbys

Previously repmgr required that a standby is running before it can be registered. However there are some use cases, such as provisioning a cascading replication server, where a downstream standby is cloned before its upstream is available, meaning even if started it won’t receive a copy of the repmgr metadata, making it impossible to locate the master server. In this case it’s now possible to specify the master server connection information (in combination with -F/--force) Additionally, if there is no metadata entry for the upstream server, a dummy record will be created for this; when registering the upstream server, this record must itself be registered with the -F/--force option to overwrite the dummy record.

Further links

Leave a Reply

Your email address will not be published. Required fields are marked *