From 55f203a2fca596f5486f78284e09603008b7f3d9 Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Wed, 13 Sep 2017 13:23:16 +0900 Subject: [PATCH] Add "-o ConnectTimeout=10" as default in "ssh_options" --- configfile.c | 22 +++++++++++++++------- configfile.h | 10 +++++++--- repmgr.conf.sample | 2 +- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/configfile.c b/configfile.c index fc357531..c590309c 100644 --- a/configfile.c +++ b/configfile.c @@ -254,9 +254,6 @@ _parse_config(t_configuration_options *options, ItemList *error_list, ItemList * *------------------------ */ options->use_replication_slots = false; - memset(options->rsync_options, 0, sizeof(options->rsync_options)); - memset(options->ssh_options, 0, sizeof(options->ssh_options)); - strncpy(options->ssh_options, "-q", sizeof(options->ssh_options)); memset(options->replication_user, 0, sizeof(options->replication_user)); memset(options->pg_basebackup_options, 0, sizeof(options->pg_basebackup_options)); memset(options->restore_command, 0, sizeof(options->restore_command)); @@ -316,9 +313,18 @@ _parse_config(t_configuration_options *options, ItemList *error_list, ItemList * * barman settings * --------------- */ + memset(options->barman_host, 0, sizeof(options->barman_host)); memset(options->barman_server, 0, sizeof(options->barman_server)); memset(options->barman_config, 0, sizeof(options->barman_config)); + /*------------------- + * rsync/ssh settings + * ------------------ + */ + memset(options->rsync_options, 0, sizeof(options->rsync_options)); + memset(options->ssh_options, 0, sizeof(options->ssh_options)); + strncpy(options->ssh_options, "-q -o ConnectTimeout=10", sizeof(options->ssh_options)); + /*--------------------------- * undocumented test settings *--------------------------- @@ -422,10 +428,6 @@ _parse_config(t_configuration_options *options, ItemList *error_list, ItemList * /* standby clone settings */ else if (strcmp(name, "use_replication_slots") == 0) options->use_replication_slots = parse_bool(value, name, error_list); - else if (strcmp(name, "rsync_options") == 0) - strncpy(options->rsync_options, value, MAXLEN); - else if (strcmp(name, "ssh_options") == 0) - strncpy(options->ssh_options, value, MAXLEN); else if (strcmp(name, "pg_basebackup_options") == 0) strncpy(options->pg_basebackup_options, value, MAXLEN); else if (strcmp(name, "tablespace_mapping") == 0) @@ -527,6 +529,12 @@ _parse_config(t_configuration_options *options, ItemList *error_list, ItemList * else if (strcmp(name, "barman_config") == 0) strncpy(options->barman_config, value, MAXLEN); + /* rsync/ssh settings */ + else if (strcmp(name, "rsync_options") == 0) + strncpy(options->rsync_options, value, MAXLEN); + else if (strcmp(name, "ssh_options") == 0) + strncpy(options->ssh_options, value, MAXLEN); + /* undocumented settings for testing */ else if (strcmp(name, "promote_delay") == 0) options->promote_delay = repmgr_atoi(value, name, error_list, 1); diff --git a/configfile.h b/configfile.h index 0643dba9..7beb4961 100644 --- a/configfile.h +++ b/configfile.h @@ -84,8 +84,6 @@ typedef struct /* standby action settings */ bool use_replication_slots; - char rsync_options[MAXLEN]; - char ssh_options[MAXLEN]; char pg_basebackup_options[MAXLEN]; char restore_command[MAXLEN]; TablespaceList tablespace_mapping; @@ -135,6 +133,10 @@ typedef struct char barman_server[MAXLEN]; char barman_config[MAXLEN]; + /* rsync/ssh settings */ + char rsync_options[MAXLEN]; + char ssh_options[MAXLEN]; + /* undocumented test settings */ int promote_delay; } t_configuration_options; @@ -150,7 +152,7 @@ typedef struct /* log settings */ \ "", "", "", DEFAULT_LOG_STATUS_INTERVAL, \ /* standby action settings */ \ - false, "", "", "", "", { NULL, NULL }, "", false, \ + false, "", "", { NULL, NULL }, "", false, \ /* node check settings */ \ DEFAULT_ARCHIVE_READY_WARNING, DEFAULT_ARCHIVE_READY_CRITICAL, \ DEFAULT_REPLICATION_LAG_WARNING, DEFAULT_REPLICATION_LAG_CRITICAL, \ @@ -171,6 +173,8 @@ typedef struct "", "", { NULL, NULL }, \ /* barman settings */ \ "", "", "", \ + /* rsync/ssh settings */ \ + "", "", \ /* undocumented test settings */ \ 0 \ } diff --git a/repmgr.conf.sample b/repmgr.conf.sample index c0003fe4..431559a7 100644 --- a/repmgr.conf.sample +++ b/repmgr.conf.sample @@ -151,7 +151,7 @@ #pg_ctl_options='' # Options to append to "pg_ctl" #pg_basebackup_options='' # Options to append to "pg_basebackup" #rsync_options='' # Options to append to "rsync" -ssh_options='-q' # Options to append to "ssh" +ssh_options='-q -o ConnectTimeout=10' # Options to append to "ssh"