diff --git a/HISTORY b/HISTORY
index cfd7c738..bad2bacd 100644
--- a/HISTORY
+++ b/HISTORY
@@ -2,6 +2,7 @@
repmgr: add parameter "shutdown_check_timeout" for use by "standby switchover";
GitHub #504 (Ian)
repmgr: add "--node-id" option to "repmgr cluster cleanup"; GitHub #493 (Ian)
+ repmgr: add configuration file parameter "repmgr_bindir"; GitHub #246 (Ian)
4.1.1 2018-09-05
logging: explicitly log the text of failed queries as ERRORs to
diff --git a/configfile.c b/configfile.c
index d3fdddb7..2479acc6 100644
--- a/configfile.c
+++ b/configfile.c
@@ -288,6 +288,7 @@ _parse_config(t_configuration_options *options, ItemList *error_list, ItemList *
memset(options->data_directory, 0, sizeof(options->data_directory));
memset(options->config_directory, 0, sizeof(options->data_directory));
memset(options->pg_bindir, 0, sizeof(options->pg_bindir));
+ memset(options->repmgr_bindir, 0, sizeof(options->repmgr_bindir));
options->replication_type = REPLICATION_TYPE_PHYSICAL;
/*-------------
@@ -490,6 +491,8 @@ _parse_config(t_configuration_options *options, ItemList *error_list, ItemList *
}
else if (strcmp(name, "pg_bindir") == 0)
strncpy(options->pg_bindir, value, MAXPGPATH);
+ else if (strcmp(name, "repmgr_bindir") == 0)
+ strncpy(options->repmgr_bindir, value, MAXPGPATH);
else if (strcmp(name, "replication_type") == 0)
{
diff --git a/configfile.h b/configfile.h
index 975c8f8e..ab2151d2 100644
--- a/configfile.h
+++ b/configfile.h
@@ -75,6 +75,7 @@ typedef struct
char data_directory[MAXPGPATH];
char config_directory[MAXPGPATH];
char pg_bindir[MAXPGPATH];
+ char repmgr_bindir[MAXPGPATH];
int replication_type;
/* log settings */
@@ -171,7 +172,7 @@ typedef struct
#define T_CONFIGURATION_OPTIONS_INITIALIZER { \
/* node information */ \
- UNKNOWN_NODE_ID, "", "", "", "", "", "", REPLICATION_TYPE_PHYSICAL, \
+ UNKNOWN_NODE_ID, "", "", "", "", "", "", "", REPLICATION_TYPE_PHYSICAL, \
/* log settings */ \
"", "", "", DEFAULT_LOG_STATUS_INTERVAL, \
/* standby clone settings */ \
diff --git a/doc/appendix-release-notes.sgml b/doc/appendix-release-notes.sgml
index a0bf21fe..6f582f98 100644
--- a/doc/appendix-release-notes.sgml
+++ b/doc/appendix-release-notes.sgml
@@ -37,6 +37,23 @@
+
+
+
+
+ New parameter repmgr_bindir added, to facilitate remote invocation of repmgr
+ when the repmgr binary is located somewhere other than the PostgreSQL binary directory, as it
+ cannot be assumed all package maintainers will install &repmgr; there.
+
+
+ This parameter is optional; if not set (the default), &repmgr; will fall back
+ to (if set).
+
+
+ (GitHub #246).
+
+
+
diff --git a/doc/quickstart.sgml b/doc/quickstart.sgml
index 03899743..5a8b68ef 100644
--- a/doc/quickstart.sgml
+++ b/doc/quickstart.sgml
@@ -237,13 +237,6 @@
server. See sections and
for further details about repmgr.conf.
-
-
- For Debian-based distributions we recommend explictly setting
- to the directory where pg_ctl and other binaries
- not in the standard path are located. For PostgreSQL 9.6 this would be /usr/lib/postgresql/9.6/bin/.
-
-
@@ -262,6 +255,24 @@
+
+
+ For Debian-based distributions we recommend explictly setting
+ to the directory where pg_ctl and other binaries
+ not in the standard path are located. For PostgreSQL 9.6 this would be /usr/lib/postgresql/9.6/bin/.
+
+
+
+
+
+ If your distribution places the &repmgr; binaries in a location other than the
+ PostgreSQL installation directory, specify this with
+ to enable &repmgr; to perform operations (e.g.
+ repmgr cluster crosscheck)
+ on other nodes.
+
+
+
See the file
repmgr.conf.sample>
diff --git a/repmgr-action-cluster.c b/repmgr-action-cluster.c
index b41229f0..83fbfe47 100644
--- a/repmgr-action-cluster.c
+++ b/repmgr-action-cluster.c
@@ -999,7 +999,7 @@ build_cluster_matrix(t_node_matrix_rec ***matrix_rec_dest, int *name_length)
*/
appendPQExpBuffer(&command,
"\"%s -d '%s' ",
- make_pg_path(progname()),
+ make_repmgr_path(progname()),
cell->node_info->conninfo);
@@ -1182,7 +1182,7 @@ build_cluster_crosscheck(t_node_status_cube ***dest_cube, int *name_length)
appendPQExpBuffer(&command,
"%s -d '%s' --node-id=%i ",
- make_pg_path(progname()),
+ make_repmgr_path(progname()),
cell->node_info->conninfo,
remote_node_id);
diff --git a/repmgr-client-global.h b/repmgr-client-global.h
index d2a4aa65..c424cd9d 100644
--- a/repmgr-client-global.h
+++ b/repmgr-client-global.h
@@ -231,6 +231,7 @@ extern int copy_remote_files(char *host, char *remote_user, char *remote_path,
extern void print_error_list(ItemList *error_list, int log_level);
extern char *make_pg_path(const char *file);
+extern char *make_repmgr_path(const char *file);
extern void get_superuser_connection(PGconn **conn, PGconn **superuser_conn, PGconn **privileged_conn);
diff --git a/repmgr-client.c b/repmgr-client.c
index 51005f3d..432bd7ad 100644
--- a/repmgr-client.c
+++ b/repmgr-client.c
@@ -2483,6 +2483,22 @@ make_pg_path(const char *file)
}
+char *
+make_repmgr_path(const char *file)
+{
+ if (config_file_options.repmgr_bindir[0] != '\0')
+ {
+ maxlen_snprintf(path_buf, "%s%s", config_file_options.repmgr_bindir, file);
+ }
+ else
+ {
+ maxlen_snprintf(path_buf, "%s%s", pg_bindir, file);
+ }
+
+ return path_buf;
+}
+
+
int
copy_remote_files(char *host, char *remote_user, char *remote_path,
char *local_path, bool is_directory, int server_version_num)
@@ -2674,9 +2690,8 @@ make_remote_repmgr_path(PQExpBufferData *output_buf, t_node_info *remote_node_re
{
appendPQExpBuffer(output_buf,
"%s -f %s ",
- make_pg_path(progname()),
+ make_repmgr_path(progname()),
remote_node_record->config_file);
-
}
diff --git a/repmgr.conf.sample b/repmgr.conf.sample
index 28296f40..b77ba5a2 100644
--- a/repmgr.conf.sample
+++ b/repmgr.conf.sample
@@ -147,7 +147,11 @@
# *NOTE* "pg_bindir" is only used when repmgr directly
# executes PostgreSQL binaries; any user-defined scripts
# *must* be specified with the full path
- #
+
+#repmgr_bindir='' # Path to repmgr binary directory (location of the repmgr
+ # binary. Only needed if the repmgr executable is not in
+ # the system $PATH or the path defined in "pg_bindir".
+
#use_primary_conninfo_password=false # explicitly set "password" in recovery.conf's
# "primary_conninfo" parameter using the value contained
# in the environment variable PGPASSWORD