Emergency mode
Emergency mode is the last resort when the cluster has lost quorum for good: enough managers are gone, with their data, that a normal membership change can never be agreed again because that itself needs the missing majority. clouduler emergency makes one surviving manager the cluster's only voter, brings back one stack you name, and holds every other stack off until a second manager returns.
It bypasses consensus by rewriting the node's own database. Read Dangers before running it.
If the lost managers will come back with their data intact, do not use it: a returning manager would conflict with the one you made sole voter. If a majority of managers is still up, do not use it either; use clouduler node remove for the dead ones.
When to use it
- A blackout or dead disks took out most managers and their raft state is gone with no usable backup.
- A multi-site partition left one site with a minority of managers and the other site is not coming back.
- You need one important stack (say, your DNS or password manager) running again right now.
What it does
- Reads the stack's spec from this node's own local database and works out which volumes it mounts. If the stack is not in the local state (deployed after this node last replicated), it refuses.
- Shows a warning and asks for confirmation.
- Rewrites the local raft membership so this node is the only voter. The other nodes stay known as learners, not dropped, so they can rejoin.
- Records the named stack as the emergency stack.
- Marks every other node unreachable, so served drives the stack uses fail over to this node.
- Marks each volume the stack uses as current on this node: this node becomes the primary. Nothing is pulled from elsewhere.
- Writes the state back. Assignments and every stack's desired state are not changed.
Then you start the daemon. Only the emergency stack is scheduled.
Run it
There is no web UI for this. It runs on the node you are rescuing, with its daemon stopped, because it writes straight to the node's database.
sudo systemctl stop clouduler.service
sudo clouduler --config /etc/clouduler/cluster.yaml emergency site --node atlas
sudo systemctl start clouduler.service
clouduler status # EMERGENCY MODE: only stack site is being scheduled
--node defaults to the hostname (or CLOUDULER_NODE), --yes skips the confirmation. There is no dry run. emergency does not accept --via.
<STACK>requiredstack nameno defaultnode namedefault hostnamepathdefault /etc/clouduler/cluster.yamlpathdefault data_dir from config (/var/lib/clouduler)If the daemon is still running, the command fails with the database error Database already open. Cannot acquire lock. Stop the daemon first.
How it ends
Emergency mode clears by itself when the leader sees another voting manager reachable again (log: another manager is reachable again, ending emergency mode). Every stack then resumes from its own desired state; nothing needs restoring by hand. A worker coming back does not end it. A demoted manager does, once its daemon answers and it is re-added as a voter automatically. You cannot turn it off by hand.
The Nodes page shows the No quorum banner with "Emergency mode is on for STACK. It clears when the managers reconnect."
Dangers
- Recent writes are lost. The rescued node's copy of each volume is trusted as current. It may be behind the primary that died (replicas sync every 15 minutes by default), and whatever was never synced is gone.
- Old managers can conflict. They are demoted, not deleted. If one returns with its old state intact it conflicts with the new log.
- It does not end if the lost manager never returns. Removing the dead manager does not end it. Add a new voting manager (a manager join, see Node lifecycle). Two voters tolerate no failure, so add a third quickly.
- Other stacks are paused, not touched. No other stack is scheduled anywhere until it ends: no new deploys, moves or restarts. Their desired state is untouched, and containers of other stacks that are already running on this node are left running as they are (not stopped, not removed, not recreated). Only the emergency stack's own containers are acted on. Volume data is not deleted.
node removeof the dead manager can fail. It is refused while that node still owns instances, and emergency mode does not reschedule other stacks, so their instances stay assigned to it (the refusal readsnode X still runs INSTANCE). The command's closing message suggests removing the lost manager, which can fail for this reason. Stop and remove those stacks first, or wait for a replacement manager.- Served drives the stack uses now point at this node, and every other node is marked unreachable until it answers.
The success message ends with a garbled sentence about promotion; it means a returning manager is re-added as a voter automatically once its daemon answers.
Related
- Failover, Node lifecycle, Git backup
- To refill lost content (stacks, configs, secrets) after recovery, see disaster recovery in Git backup.
restorerefills content only;emergencyis the membership step.