repmgr standby register

Name

repmgr standby register -- add a standby's information to the repmgr metadata

Description

repmgr standby register adds a standby's information to the repmgr metadata. This command needs to be executed to enable promote/follow operations and to allow repmgrd to work with the node. An existing standby can be registered using this command. Execute with the --dry-run option to check what would happen without actually registering the standby.

Note: If providing the configuration file location with -f/--config-file, avoid using a relative path, as repmgr stores the configuration file location in the repmgr metadata for use when repmgr is executed remotely (e.g. during repmgr standby switchover). repmgr will attempt to convert the a relative path into an absolute one, but this may not be the same as the path you would explicitly provide (e.g. ./repmgr.conf might be converted to /path/to/./repmgr.conf, whereas you'd normally write /path/to/repmgr.conf).

Waiting for the the standby to start

By default, repmgr will wait 30 seconds for the standby to become available before aborting with a connection error. This is useful when setting up a standby from a script, as the standby may not have fully started up by the time repmgr standby register is executed.

To change the timeout, pass the desired value with the --wait-start option. A value of 0 will disable the timeout.

The timeout will be ignored if -F/--force was provided.

Waiting for the registration to propagate to the standby

Depending on your environment and workload, it may take some time for the standby's node record to propagate from the primary to the standby. Some actions (such as starting repmgrd) require that the standby's node record is present and up-to-date to function correctly.

By providing the option --wait-sync to the repmgr standby register command, repmgr will wait until the record is synchronised before exiting. An optional timeout (in seconds) can be added to this option (e.g. --wait-sync=60).

Registering an inactive node

Under some circumstances you may wish to register a standby which is not yet running; this can be the case when using provisioning tools to create a complex replication cluster. In this case, by using the -F/--force option and providing the connection parameters to the primary server, the standby can be registered.

Similarly, with cascading replication it may be necessary to register a standby whose upstream node has not yet been registered - in this case, using -F/--force will result in the creation of an inactive placeholder record for the upstream node, which will however later need to be registered with the -F/--force option too.

When used with repmgr standby register, care should be taken that use of the -F/--force option does not result in an incorrectly configured cluster.

Event notifications

A standby_register event notification will be generated immediately after the node record is updated on the primary.

If the --wait-sync option is provided, a standby_register_sync event notification will be generated immediately after the node record has synchronised to the standby.

If provided, repmgr will subsitute the placeholders %p with the node ID of the primary node, %c with its conninfo string, and %a with its node name.