From 35d2146c1a801a2b478a19b9d62af0f10279fd34 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 13 Apr 2021 10:11:31 -0400 Subject: [PATCH] mgr/MgrStandby: add mgr_standby_modules option Add config option to control whether the standby modules are started. Default to true (no change in behavior), but if set to false the standby mgr modules don't do the redirect business. Signed-off-by: Sage Weil --- src/common/options/global.yaml.in | 11 +++++++++++ src/mgr/MgrStandby.cc | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/common/options/global.yaml.in b/src/common/options/global.yaml.in index 5c7f4a4317fd7..c27feef5e7778 100644 --- a/src/common/options/global.yaml.in +++ b/src/common/options/global.yaml.in @@ -7814,6 +7814,17 @@ options: default: @CEPH_INSTALL_DATADIR@/mgr services: - mgr +- name: mgr_standby_modules + type: bool + default: true + level: advanced + desc: Start modules in standby (redirect) mode when mgr is standby + long_desc: By default, the standby modules will answer incoming requests with a + HTTP redirect to the active manager, allowing users to point their browser at any + mgr node and find their way to an active mgr. However, this mode is problematic + when using a load balancer because (1) the redirect locations are usually private + IPs and (2) the load balancer can't identify which mgr is the right one to send + traffic to. If a load balancer is being used, set this to false. - name: mgr_disabled_modules type: str level: advanced diff --git a/src/mgr/MgrStandby.cc b/src/mgr/MgrStandby.cc index 37a2219bccbde..ea15a1456eb5d 100644 --- a/src/mgr/MgrStandby.cc +++ b/src/mgr/MgrStandby.cc @@ -425,7 +425,8 @@ void MgrStandby::handle_mgr_map(ref_t mmap) if (map.active_gid != 0 && map.active_name != g_conf()->name.get_id()) { // I am the standby and someone else is active, start modules // in standby mode to do redirects if needed - if (!py_module_registry.is_standby_running()) { + if (!py_module_registry.is_standby_running() && + g_conf().get_val("mgr_standby_modules")) { py_module_registry.standby_start(monc, finisher); } } -- 2.39.5