13.2. repmgrd daemon

If installed from a package, the repmgrd can be started via the operating system's service command, e.g. in systemd using systemctl.

See appendix Package details for details of service commands for different distributions.

repmgrd can be started manually like this:

        repmgrd -f /etc/repmgr.conf --pid-file /tmp/repmgrd.pid --daemonize

and stopped with kill `cat /tmp/repmgrd.pid`. Adjust paths as appropriate.

13.2.1. repmgrd daemon configuration on Debian/Ubuntu

If repmgr was installed from Debian/Ubuntu packages, additional configuration is required before repmgrd is started as a daemon.

This is done via the file /etc/default/repmgrd, which by default looks like this:

# default settings for repmgrd. This file is source by /bin/sh from
# /etc/init.d/repmgrd

# disable repmgrd by default so it won't get started upon installation
# valid values: yes/no
REPMGRD_ENABLED=no

# configuration file (required)
#REPMGRD_CONF="/path/to/repmgr.conf"

# additional options
#REPMGRD_OPTS=""

# user to run repmgrd as
#REPMGRD_USER=postgres

# repmgrd binary
#REPMGRD_BIN=/usr/bin/repmgrd

# pid file
#REPMGRD_PIDFILE=/var/run/repmgrd.pid

Set REPMGRD_ENABLED to yes, and REPMGRD_CONF to the repmgr.conf file you are using.

If using systemd, you may need to execute systemctl daemon-reload. Also, if you attempted to start repmgrd using systemctl start repmgrd, you'll need to execute systemctl stop repmgrd. Because that's how systemd rolls.