Search code examples
postgresqlrepmgr

repmgr standby switchover failed with ERROR: unable to connect via SSH to host "node IP", user ""


$ repmgr standby switchover -v
INFO: looking for configuration file in /etc
INFO: configuration file found at: "/etc/repmgr.conf"
NOTICE: executing switchover on node "DB-Test-02" (ID: 2)
WARNING: unable to connect to remote host "IP" via SSH
ERROR: unable to connect via SSH to host "IP", user ""

repmgrd service is stopped on primary,standbyand witness server.

I checked by connecting nodes from each other using SSH and that works.

Any hint ?


Solution

  • For successful switchover paswword less SSH is required. Try this. https://tecadmin.net/password-less-ssh-login-setup/

    2nd is, need to set up below commands in /etc/sudoers file.

        Defaults:postgres !requiretty
        postgres ALL = NOPASSWD: /usr/bin/pg_ctlcluster 12 main stop, \
        /usr/bin/pg_ctlcluster 12 main start, \
        /usr/bin/pg_ctlcluster 12 main restart \
        /usr/bin/pg_ctlcluster 12 main reload
    

    In /etc/repmgr.conf file.

         service_start_command   = 'sudo pg_ctlcluster 12 main start'
         service_stop_command    = 'sudo pg_ctlcluster 12 main stop'
         service_restart_command = 'sudo pg_ctlcluster 12 main restart'
         service_reload_command  = 'sudo pg_ctlcluster 12 main reload'
    

    This works for me.