Runbook: Pacemaker failover - test and recover
1 · Prerequisites
Confirm every item is in place before any state change.
2 · Pre-checks
Read-only diagnostic commands. If any of these don't match expected output, stop and investigate further.
- · Verify STONITH is functional for every node
- · Verify all resources are configured and constraints applied
- · Verify quorum is healthy
- · Capture current state as baseline
3 · Procedure
Execute each step in order. Verify the expected output of a step before moving to the next.
- 1Identify the resource to move or fail
- 2Choose the failover method: graceful move or STONITH
- 3For graceful: pcs resource move <resource> <node> --lifetime=PT30M
- 4For STONITH: pcs stonith fence <node>
- 5Verify resources migrated correctly
- 6Verify the service works
- 7Clear the move constraint: pcs resource clear <resource>
- 8Test reverse: move the resource back, then clear again
- 9Document the test
4 · Verification
Confirm the procedure actually fixed the problem.
- ✓Resource migrated successfully
- ✓Service works on the new node
- ✓Quorum is healthy
- ✓Reverse move works
- ✓No cli-ban or cli-prefer constraints remain (pcs constraint config --full)
5 · Rollback
If verification fails, undo the procedure in reverse order.
- ↶If the resource did not migrate, check constraints and STONITH
- ↶If the resource will not return to its original node, look for a leftover cli-ban constraint and clear it
- ↶If the service is broken on the new node, investigate the resource agent
- ↶If quorum is lost, do NOT force it. Confirm first that the other partition is powered off (BMC chassis power status) or has released its storage reservations - forcing quorum against a live partition is how split brain happens
- ↶Once proven dead: sudo pcs quorum unblock --yes, then confirm with pcs quorum status and pcs status that exactly one partition owns each resource
6 · Escalation
When the runbook isn't enough, contact:
- · If STONITH does not work, escalate to hardware team
- · If the resource agent fails, escalate to application team
- · If the data is suspect, escalate to data team
This runbook tests and recovers from Pacemaker failover. The test verifies that the cluster handles failure correctly; the recovery is the actual failover.
When to use this runbook
Use this runbook when:
- A node has failed and resources need to be migrated.
- Testing failover in a quarterly drill.
- Recovering from a planned downtime.
Inputs
Gather before starting:
- Cluster name and node names.
- The BMC credential file,
/etc/pacemaker/bmc-pw, mode 0600 and owned by root. Not the password itself. - Resource names and their dependencies.
- A maintenance window (for testing).
- Communication channels (war room, on-call).
Procedure
Step 1: Capture the baseline
sudo pcs status
sudo pcs resource status
sudo pcs resource configDocument the current state. The test will compare against
this. pcs resource show was removed in pcs 0.11: use
pcs resource status for state and pcs resource config for
configuration. The same split applies to pcs stonith and
pcs constraint.
Step 2: Choose the failover method
Two methods:
- Graceful move:
pcs resource move <resource> <node>. The resource is stopped on the current node and started on the new node. Used for planned failover. - STONITH:
pcs stonith fence <node>. The node is powered off; the cluster considers it dead; resources migrate. Used for unplanned failover.
Both belong in a quarterly test, but they are not interchangeable and they answer different questions. The graceful move proves the resources can run on the other node. Only a real fence proves the fence device works — the credential, the network path to the BMC, and the host mapping — and that is the component whose failure blocks every recovery the cluster would otherwise perform.
The cost of that proof is a hard power-off. Do the graceful move first; if it fails, fix that before fencing anything.
Step 3: Test graceful move
pcs resource move does not “push” a resource anywhere. It
creates a location constraint - a cli-ban rule with
score -INFINITY against the node the resource is currently
on - and the cluster then has nowhere else to run it but the
target. The move is a side effect of a rule that is still in
the CIB afterwards.
Whether that rule clears itself depends on the version: older
pcs 0.10 leaves it in place until you remove it, while
newer Pacemaker auto-clears a completed move. Do not rely on
either. Bound it explicitly:
# Preferred: the constraint expires on its own.
sudo pcs resource move web node2 --lifetime=PT30M
# Or move without a lifetime, then clear it yourself in this same step.
sudo pcs resource move web node2Verify, and look at the constraints as well as the status:
sudo pcs status
sudo pcs constraint config --full | grep -i 'cli-ban\|cli-prefer'The resource should be on node2, and you should be able to
name every cli-ban or cli-prefer entry that command
prints. Anything you cannot account for is left over from an
earlier move.
Step 4: Test STONITH
There is no dry run. pcs stonith fence cuts power to the
node immediately — no graceful stop, no resource shutdown,
every process killed where it stands. Confirm all four
preconditions before running it:
sudo pcs quorum status # survivors must stay quorate without node1
sudo pcs status # no resource already Stopped or failed
sudo pcs stonith status # the device for node1 reads Started
sudo fence_ipmilan --ip=<node1-bmc> --username=<user> \
--password-script=/etc/cluster/bmc-pw.sh --lanplus --action=statusYou also need console or BMC access to power node1 back on, and a maintenance window. One node at a time.
sudo pcs stonith fence node1Verify:
- The node is actually powered off (check via BMC).
- Resources have migrated to other nodes.
sudo pcs stonith history showrecords the action as completed, not failed.- After powering node1 back on, it rejoins and
sudo pcs statusshows no failed actions once you have runsudo pcs resource cleanup.
Step 5: Verify the service, then clear the constraint
After the failover, verify the service works:
# Smoke test
curl -I http://<vip>/health
# Synthetic monitoring (if configured)
# Real traffic (if in production)The moment the smoke test passes, remove the move constraint. This is not a tidy-up task for the end of the runbook; it is part of verifying the failover:
sudo pcs resource clear web
sudo pcs constraint config --full | grep -ci 'cli-ban\|cli-prefer' # must be 0The resource stays where it is - clearing the ban only restores the cluster’s freedom to place it. If it immediately moves back, that tells you the cluster’s own preference differs from where you put it, which is worth knowing before an incident does the experiment for you.
If the service does not work:
- Check the resource agent logs.
- Check that constraints are correctly applied.
- Check that the new node has the prerequisites.
Step 6: Test reverse
Move the resource back:
sudo pcs resource move web node1 --lifetime=PT30Mpcs resource clear removes the constraint from the earlier
move; it does not move the
resource. To relocate it deliberately you issue a new move,
and that move creates a new constraint - so it needs the same
--lifetime or the same explicit clear afterwards:
sudo pcs resource clear web
sudo pcs constraint config --full | grep -ci 'cli-ban\|cli-prefer' # must be 0Verify the service works on the original node.
Step 7: Bring the failed node back
If a node was fenced:
# Power on via BMC. -f reads the password from the root-only
# credential file; -P would put it in /proc/<pid>/cmdline for
# every local user, and in this shell's history.
sudo ipmitool -I lanplus -H <bmc-ip> -U admin \
-f /etc/pacemaker/bmc-pw chassis power on
# Wait for the node to rejoin
sleep 60
sudo pcs statusThat credential is power control for every node in the cluster. A leak turns a routine failover drill into someone else’s ability to fence your cluster at will.
Step 8: Document
In the run log:
- Time of test.
- Method (graceful or STONITH).
- Time to recover.
- Findings.
- Improvements.
Common patterns
| Symptom | Likely cause | Resolution |
|---|---|---|
| Resource did not migrate | Constraints violated | Check constraints |
| Resource never returns to a node | Leftover cli-ban from an earlier pcs resource move | pcs constraint config --full, then pcs resource clear <resource> |
| Service broken after move | Missing dependencies | Check application config |
| STONITH did not work | STONITH device broken | Repair device |
| Quorum lost | Network issue | Restore network |
| Resource flapping | Monitor failure | Investigate monitor |
Knowledge check
Knowledge check · 5 questions
Q1. What is the first step in testing cluster failover?
Q2. STONITH test is only for production clusters.
Q3. Which of the following are valid failover test methods? Select all that apply.
Q4. Three weeks after a failover drill, node2 fails. The web resource does not start on node1 even though node1 is healthy and quorate, and pcs status shows nothing unusual. What do you check first?
Q5. After pcs resource clear, the resource usually stays exactly where it is.
Passing score: 75%. Answers are checked in this browser.