repmgr primary register

repmgr primary register

initialise a repmgr installation and register the primary node

## Description

`repmgr primary register` registers a primary node in a streaming replication cluster, and configures it for use with &repmgr;, including installing the &repmgr; extension. This command needs to be executed before any standby nodes are registered.

&repmgr; will attempt to install the &repmgr; extension as part of this command, however this will fail if the `repmgr` user is not a superuser.

It's possible to install the &repmgr; extension manually before executing `repmgr primary register`; in this case &repmgr; will detect the presence of the extension and skip that step.

## Execution

Execute with the `--dry-run` option to check what would happen without actually registering the primary.

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`).

`repmgr master register` can be used as an alias for `repmgr primary register`.

## User permission requirements

The `repmgr` user must be a superuser in order for &repmgr; to be able to install the `repmgr` extension.

If this is not the case, the `repmgr` extension can be installed manually before executing `repmgr primary register`.

A future &repmgr; release will enable the provision of a `--superuser` name for the installation of the extension.

## Options

`--dry-run`

- Check prerequisites but don't actually register the primary.

`-F`, `--force`

- Overwrite an existing node record

## Event notifications

Following event notifications will be generated:

- `cluster_created`

- `primary_register`