This article will help you configure STONITH in a Pacemaker cluster using shared storage and Storage Based Death (SBD)
# yum install -y sbd fence-agents-sbd
Example config file is installed in: /etc/sysconfig/sbd
Most of the defaults will be fine, and really all you need to do is specify the watchdog device present on your machine, and the "disk" to be used for placing poison pills. Simply set SBD_WATCHDOG_DEV to the path where sbd can find your watchdog device, and SBD_DEVICE to the /dev/SBD you want to use for poison pills. (replace /dev/SBD with the disk you actually want to use).
Beware: If uname -n does not match the name of the node in the cluster configuration, you will need to pass the advertised name to SBD with the -n option.
Eg. SBD_OPTS="-n special-name-1"
See also the sbd man page.
You need to prepare the device:
1. "initialize" the slots:
# sbd -d /dev/SBD create
2. check what was written:
# sbd -d /dev/SBD dump
Anyways, you double check that the sbd config file is present on both nodes, and start the sbd daemon.
3. this should list the node ids and node names:
# sbd -d /dev/SBD list
0 alice clear
1 bob clear
4. you can send a test message:
# sbd -d /dev/SBD message alice test
and the sbd daemon should log to syslog something like
... alice sbd: [...]: info: Received command test from bob
5. Add the Pacemaker configurations:
primitive f_sbd_node_a stonith:fence_sbd devices=/dev/SBD plug=node-a
primitive f_sbd_node_b stonith:fence_sbd devices=/dev/SBD plug=node-b
where you use the node names as shown by sbd -d /dev/SBD list, which should be the same as reported by crm_mon, or by crm_node. You should then add location constraints to force f_sbd_node_a to only run on node b, and vice versa.
Reviewed 2020/12/01 - DGT