3.3. Create the repmgr user and database

Create a dedicated PostgreSQL superuser account and a database for the repmgr metadata, e.g.

   createuser -s repmgr
   createdb repmgr -O repmgr
  

For the examples in this document, the name repmgr will be used for both user and database, but any names can be used.

Note

For the sake of simplicity, the repmgr user is created as a superuser. If desired, it's possible to create the repmgr user as a normal user. However for certain operations superuser permissions are required; in this case the command line option --superuser can be provided to specify a superuser.

It's also assumed that the repmgr user will be used to make the replication connection from the standby to the primary; again this can be overridden by specifying a separate replication user when registering each node.

Tip

repmgr will install the repmgr extension, which creates a repmgr schema containing the repmgr's metadata tables as well as other functions and views. We also recommend that you set the repmgr user's search path to include this schema name, e.g.

       ALTER USER repmgr SET search_path TO repmgr, "$user", public;