Skip to main content
RunBook Academy

LinuxLXIV · Rolling MaintenanceMaintenance mode

Maintenance mode and drain - the safe cluster update

Intermediate⏱ ~10 minpcs

What you'll learn

  • Choose between node standby, node maintenance, and cluster-wide maintenance mode
  • Drain traffic from a node
  • Validate the drain worked
  • Audit and clear the location constraints a move leaves behind
  • Bring the node back to service

Prerequisites

Verified against Ubuntu 24.04 LTS · Debian 12 (Bookworm) · RHEL 9.x · Rocky Linux 9.x · AlmaLinux 9.x · Linux kernel 6.1 LTS / 6.6 LTS · systemd 255+ · OpenSSH 8.7p1 (RHEL 9) / 9.6p1 (Ubuntu 24.04) · nftables 1.0.x · chrony 4.x · Pacemaker 2.1.x · Corosync 3.1.x · 2026-08-09

Not yet marked complete on this device.

Maintenance mode and drain are the tools for safely updating cluster nodes. The cluster manager stops sending work to a node in maintenance; the application can be restarted without losing traffic.

Three different things, often called “maintenance”

Pacemaker has three controls here and they are not interchangeable. Picking the wrong one either drops the service you were trying to protect, or leaves the cluster blind while you work.

ControlResources on the nodeCluster still monitors?Use it when
pcs node standby <node>Stopped, started elsewhereYes, everywhereYou are rebooting or patching the node
pcs node maintenance <node>Left running, unmanagedNo, on that nodeYou are restarting the application in place
pcs property set maintenance-mode=trueLeft running, unmanagedNo, anywhere; no fencingYou are editing the cluster stack itself

Standby - drain the node

# Stop this node's resources and start them elsewhere
pcs node standby node1

# Verify resources have moved
pcs status nodes

# Return the node to service
pcs node unstandby node1

Standby is the tool for node maintenance: reboots, kernel updates, hardware. The resources move, the cluster keeps managing and monitoring them, and failover still works while you are working.

Node maintenance - service the application in place

# Leave the resources running, but stop managing them here
pcs node maintenance node1

# Now restart the application without the cluster reacting
sudo systemctl restart myapp

# Hand it back to the cluster
pcs node unmaintenance node1

This is the one people reach for standby by mistake. If you only need to bounce or reconfigure an application in place, standby is the wrong tool: it stops the resource and relocates it, which is a failover you did not want and a client disruption you did not need. pcs node maintenance leaves the resource running and simply stops the cluster reacting to it.

Cluster-wide maintenance mode

For cluster-wide maintenance:

# Cluster-wide maintenance (no resources moved)
pcs property set maintenance-mode=true

# Disable maintenance
pcs property set maintenance-mode=false

“Does not move resources” understates it. Maintenance mode does far more than that, and the difference is the whole reason it is not a substitute for standby.

To drain a node while the cluster keeps recovering and fencing, use pcs node standby. To service an application in place, use pcs node maintenance. maintenance-mode is the tool for changing the cluster’s own configuration, and nothing else.

Drain specific resources

To drain a specific resource:

# Move a single resource. This works by injecting a location
# constraint into the CIB - it is not a hint, it is a rule.
pcs resource move web node2

# Always look at what it created
pcs constraint location config --full | grep -A2 web

# Remove the constraint. THIS is the undo.
pcs resource clear web
pcs constraint location config --full | grep web   # must be gone

The resource moves. The other resources are unaffected.

Validate the drain

# Confirm node1 is listed under Standby and hosts nothing
pcs status nodes

# Confirm the node hosts ZERO resources (no output = drained)
sudo crm_mon -1 --output-as=text | awk '/Full List of Resources/,0' | grep -w node1

# Confirm the drain left no failures behind
sudo pcs status --full | sed -n '/Failed Resource Actions/,/^$/p'

# Confirm the service still works from the remaining nodes
curl -sf http://vip/health

Read pcs status nodes, not pcs status | grep node1. A drained node reports Online (standby), so a grep for the node name matches a healthy line and tells you nothing.

If the node has no resources, no failed actions were recorded, and the service is healthy, the drain worked.

Application-level drain

For graceful drain of in-flight requests:

# Send SIGTERM to the application
sudo systemctl stop myapp    # waits for in-flight to finish

Or have the unit drain itself on stop:

# /etc/systemd/system/myapp.service
[Service]
ExecStart=/usr/local/bin/myapp
ExecStop=/usr/local/bin/myapp --drain

The application handles SIGTERM, completes in-flight requests, then exits.

Bringing the node back

# Re-enable the node
pcs node unstandby node1

# Verify: the Standby list must be empty
pcs status nodes
pcs status

The node is back in the cluster. Resources may be re-balanced.

Standby is a node attribute in the CIB. It survives a reboot and the end of your maintenance window. Nothing clears it for you, so pair every standby with an unstandby and make the empty Standby line the exit criterion.

Knowledge check

Knowledge check · 4 questions

  1. Q1. What does "pcs node standby node1" do?

  2. Q2. You need to restart an application in place on node1 without the cluster reacting. Which command?

  3. Q3. You ran "pcs resource move web node2" during a maintenance window six months ago. What is the risk you left behind?

  4. Q4. Cluster-wide maintenance-mode=true stops monitoring and fencing everywhere, not just resource movement.

Passing score: 75%. Answers are checked in this browser.