GrepBoard/Manuals
605 manuals ·

Make a specific Ceph mgr active? What ceph mgr fail picks

·Tested on Ceph Reef 18.2 · Squid 19.2 official docs and source · 2026-10·Test scope ↓·6 steps

ceph mgr fail has no argument for the next active mgr; the monitor promotes the first standby gid. How the source picks, what the docs suggest, and the cost.

console
$ ceph mgr fail

This command fails the current active mgr and has no argument for the next one. The monitor picks one of the standby mgrs, and a source comment calls it an "arbitrary choice of standby". Neither the docs nor the source offer an argument or setting that names the next active. If only one standby mgr is left, though, that one is promoted (see [3]), so there is a workaround the docs do not recommend but the source explains; its cost is at the end of [3].

[1] Check what the docs cover. The first mgr to come up becomes active and the rest are standbys. If the active stops sending beacons for more than mon_mgr_beacon_grace (default 30 seconds) a standby replaces it. To preempt that, mark the daemon failed with ceph mgr fail <mgr name> (Manager doc L45-L61, [mon_mgr_beacon_grace definition](https://github.com/ceph/ceph/blob/v19.2.3/src/common/options/mon.yaml.in#L67-L72)). The docs do not say how the next active is chosen.

[2] Look at the current state with read-only commands.

console
$ ceph mgr stat$ ceph mgr dump

mgr dump is listed in the ceph man page, and mgr stat is defined as "dump basic info about the mgr cluster state" ([MonCommands.h L1338](https://github.com/ceph/ceph/blob/v19.2.3/src/mon/MonCommands.h#L1338)). That the map holds an active entry and a standby list was confirmed from the standbys field of MgrMap.

[3] See the selection in the source. When there is no active mgr, the monitor (MgrMonitor) calls promote_standby(). Its standby list is a std::map keyed by gid (a numeric id), and it takes the first element.

output
    // Promote a replacement (arbitrary choice of standby)    auto replacement_gid = pending_map.standbys.begin()->first;

Source: [MgrMonitor.cc L908-L936](https://github.com/ceph/ceph/blob/v19.2.3/src/mon/MgrMonitor.cc#L908-L936) (the list type is in [MgrMap.h L290](https://github.com/ceph/ceph/blob/v19.2.3/src/mon/MgrMap.h#L290)); Reef 18.2.4 has the same code (L899-L900). The first element of a sorted map is the smallest gid. The gid is the id the mgr received when it connected to the monitors (monc.get_global_id()) and it travels in the beacon ([MgrStandby.cc L285-L293](https://github.com/ceph/ceph/blob/v19.2.3/src/mgr/MgrStandby.cc#L285-L293)). Nothing in that function reads a host name or an ordering setting.

If only one standby mgr is left, that one is promoted. A standby whose beacons stopped for longer than mon_mgr_beacon_grace is culled from the list by the monitor's tick ([MgrMonitor.cc L826-L842](https://github.com/ceph/ceph/blob/v19.2.3/src/mon/MgrMonitor.cc#L826-L842)), so a stopped standby leaves the list only after that time. The cephadm docs have ceph orch daemon stop <daemonid> (operations doc L50-L56). So stopping every standby except the one you want, confirming with ceph mgr stat that one standby remains, and then running ceph mgr fail gives a result that is determined by the source. This is derived from the source, not a documented recommendation, and was not tested. While the others are stopped there is less redundancy, so undo it right after.

console
$ ceph orch daemon stop <other standby mgr daemon>$ ceph mgr stat$ ceph mgr fail$ ceph orch daemon start <other standby mgr daemon>

[4] See how ceph mgr fail proceeds ([MgrMonitor.cc L1268-L1325](https://github.com/ceph/ceph/blob/v19.2.3/src/mon/MgrMonitor.cc#L1268-L1325)).

ArgumentBehavior
nonetargets the current active; if there is none, Currently no active mgr
name or gidif it matches the active, the active is dropped; if it matches a standby, that standby is removed from the list; otherwise Daemon not found '…', already failed?
(always)afterwards, if there is no active, promote_standby() picks one by the rule above

Removing a standby with mgr fail does not evict it. At its next beacon the same gid registers again as a "new standby" ([MgrMonitor.cc L638-L660](https://github.com/ceph/ceph/blob/v19.2.3/src/mon/MgrMonitor.cc#L638-L660)). There is also a separate path where, while no active exists, the first beacon to arrive is selected as active (L615-L635). Shuffling standbys to steer the order therefore depends on beacon timing, and the source does not guarantee it.

[5] Know the cost of dropping the active. When the active is dropped, the monitor adds the previous active's address and the RADOS clients it used to the OSD map blocklist ([MgrMonitor.cc L938-L970](https://github.com/ceph/ceph/blob/v19.2.3/src/mon/MgrMonitor.cc#L938-L970)). The duration is mon_mgr_blocklist_interval, default 1 day, minimum 1 hour ([mon.yaml.in L829-L837](https://github.com/ceph/ceph/blob/v19.2.3/src/common/options/mon.yaml.in#L829-L837)). In the source this command is more than a restart. With a single mgr daemon there is no standby to hand over to (promote_standby() returns false when the list is empty or the MgrMap down flag is set, and promotes nobody: [MgrMonitor.cc L908-L913](https://github.com/ceph/ceph/blob/v19.2.3/src/mon/MgrMonitor.cc#L908-L913)).

[6] Use what the docs recommend. There are two things.

  • Make any mgr acceptable as the active one. The cephadm upgrade doc has you redeploy every standby mgr on the new version first, then run ceph mgr fail, so the active ends up on the new version (upgrade doc L300-L326). It does not choose; it makes every candidate the same.
  • Decide which hosts run mgr daemons. In cephadm the placement spec sets the count and hosts. The doc example is ceph orch apply mgr 2 (upgrade doc L180-L190), and the placement syntax (--placement="host1 host2" and so on) is in the service management doc. That decides where mgrs run, not which one is active.
console
$ ceph orch ls mgr$ ceph orch ps --daemon_type mgr

#ceph#mgr#ceph-mgr-fail#standby