standby switchover: add hint for diagnosing remote DB connection failure

Output a command, which when excuted on the local node (promotion
candidate) will attempt to remotely connect to the demotion candidate
and display both the connection message encountered and the connection
parameters used.

This is useful for corner-cases where the connection normally succeeds if a
particular environment variable (e.g. PGPORT) is normally set, but is
not set in the environment where SSH is executed.
This commit is contained in:
Ian Barwick
2020-04-17 11:20:02 +09:00
parent 45e96f21a5
commit 97d83bd443
3 changed files with 49 additions and 16 deletions

View File

@@ -24,6 +24,7 @@ extern bool local_command_return_value(const char *command, PQExpBufferData *out
extern bool local_command_simple(const char *command, PQExpBufferData *outputbuf);
extern bool remote_command(const char *host, const char *user, const char *command, const char *ssh_options, PQExpBufferData *outputbuf);
extern void make_remote_command(const char *host, const char *user, const char *command, const char *ssh_options, PQExpBufferData *ssh_command);
extern pid_t disable_wal_receiver(PGconn *conn);
extern pid_t enable_wal_receiver(PGconn *conn, bool wait_startup);