EnterpriseDB/repmgr

inaccessible via SSH

Closed this issue · 2 comments

repmgr is reporting inability to use SSH. Using the same key as in ssh_options configured, I verify that SSH works. The output "bash: repmgr: command not found" makes me think it is not using an interactive/login shell and therefore not getting its PATH set appropriately, as I can reproduce the error message by adding "repmgr" as the command directly to ssh.

I am using version 5.2.1 on RHEL 8 from the 2ndquadrant RPM repository.

[postgres@postgresql-l ~]$ grep ssh_options /etc/repmgr/12/repmgr.conf | grep -v \#
ssh_options = '-q -o ConnectTimeout=10 -i ~/.ssh/repmgr'
[postgres@postgresql-l ~]$ ssh postgres-d -i ~/.ssh/repmgr
Last login: Fri Jul 16 17:11:44 2021 from postgres-l
postgres@postgres-d\>exit
logout
Connection to postgres-d closed.
[postgres@postgresql-l ~]$ repmgr -f /etc/repmgr/12/repmgr.conf cluster crosscheck
INFO: connecting to database
bash: repmgr: command not found
 Name       | ID | 1 | 2
------------+----+---+---
 postgres-d | 1  | ? | ?
 postgres-l | 2  | ? | ?
WARNING: following problems detected:
  node 1 inaccessible via SSH
  node 2 inaccessible via SSH
[postgres@postgresql-l ~]$ repmgr -f /etc/repmgr/12/repmgr.conf cluster matrix
INFO: connecting to database
bash: repmgr: command not found
 Name       | ID | 1 | 2
------------+----+---+---
 postgres-d | 1  | ? | ?
 postgres-l | 2  | * | *
WARNING: following problems detected:
  node 1 inaccessible via SSH
[postgres@postgresql-l ~]$ ssh postgres-d -i ~/.ssh/repmgr repmgr
bash: repmgr: command not found

Commands executed via ssh don't normally run in a login shell (similar issue occurs with commands executed as a cronjob).

The preferred solution is to set pg_bindir in repmgr.conf (on all nodes) to the PostgreSQL path (e.g. pg_bindir=/usr/pgsql-11/bin/); in the unusual situation that repmgr is installed in another location, repmgr_bindir can be used. This path will be prepended when executing repmgr remotely.

That works. Is there a reason why it isn't included in the basic sample of https://repmgr.org/docs/current/configuration-file.html? Seems like an important setting to call out as required.