skip to Main Content

I am trying to set up repmgr version 5 on Debian with PostgtrSql 11.
Seems like the documentation is more oriented towards centos/RHEL.

When I am trying to setup the witnes node to start the repmgr daemon, I get an error without any idea where to look for for seeing what is the cause of the error.

This is my repmgr.conf file:

node_id=3
node_name='PG-Node-Witness'
conninfo='host=10.97.7.140 user=repmgr dbname=repmgr connect_timeout=2'
data_directory='/var/lib/postgresql/11/main'
failover='automatic'
promote_command='/usr/bin/repmgr standby promote -f /etc/repmgr.conf --log-to-file'
follow_command='/usr/bin/repmgr standby follow -f /etc/repmgr.conf --log-to-file --upstream-node-id=%n'
priority=60
monitor_interval_secs=2
connection_check_type='ping'
reconnect_attempts=6
reconnect_interval=8
primary_visibility_consensus=true
standby_disconnect_on_failover=true
repmgrd_service_start_command='sudo /etc/init.d/repmgrd start'  #??????
repmgrd_service_stop_command='sudo //etc/init.d/repmgrd stop'#??????
service_start_command='sudo /usr/bin/systemctl start [email protected]'
service_stop_command='sudo /usr/bin/systemctl stop [email protected]'
service_restart_command='sudo /usr/bin/systemctl restart [email protected]'
service_reload_command='sudo /usr/bin/systemctl relaod [email protected]'
monitoring_history=yes
log_status_interval=60

register is OK:

repmgr -f /etc/repmgr.conf witness register -h 10.97.7.97

INFO: connecting to witness node "PG-Node-Witness" (ID: 3)
INFO: connecting to primary node
NOTICE: attempting to install extension "repmgr"
NOTICE: "repmgr" extension successfully installed
INFO: witness registration complete
NOTICE: witness node "PG-Node-Witness" (ID: 3) successfully registered

repmgr daemon dry-run OK too:

$repmgr -f /etc/repmgr.conf daemon start --dry-run
INFO: prerequisites for starting repmgrd met
DETAIL: following command would be executed:
 sudo /usr/bin/systemctl start [email protected]

I setup /etc/default/repmgrd with:

REPMGRD_ENABLED=yes

and

REPMGRD_CONF="/etc/repmgr.conf"

But still get error when trying to run the daemon start:

$ repmgr -f /etc/repmgr.conf daemon start

I get:

NOTICE: executing: "sudo  /etc/init.d/repmgrd start"
ERROR: repmgrd does not appear to have started after 15 seconds
HINT: use "repmgr service status" to confirm that repmgrd was successfully started

2

Answers


  1. Chosen as BEST ANSWER

    Apparently the correct command to start the repmgr daemon is: repmgrd -f /etc/prepmgr.conf


  2. It is recommended to run repmgrd as a systemd service,
    According to the docs (for debian) you may first need to configure /etc/default/repmgrd,
    My configuration 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=yes
    
    # configuration file (required)
    REPMGRD_CONF="/etc/repmgr/12/repmgr.conf"
    
    # additional options
    REPMGRD_OPTS="--daemonize=false"
    
    # user to run repmgrd as
    REPMGRD_USER=postgres
    
    # repmgrd binary
    REPMGRD_BIN=/bin/repmgrd
    
    # pid file
    REPMGRD_PIDFILE=/var/run/repmgrd.pid
    

    Secondly, I would revisit sudoers (visudo) in order to check whether the non-root user can execute sudo /etc/init.d/repmgrd start.

    Further, the user who runs repmgr commands should be able to write logs depending on your configuration.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search