启动watchdog
每个server 执行
modprobe softdog
modprobe softdog
cat /etc/sysconfig/modules/softdog.modules
modprobe softdog
chmod 755 /etc/sysconfig/modules/softdog.modules
init 6
ls -l /dev/watchdog
crw------- 1 root root 10, 130 Aug 6 20:19 /dev/watchdog
#表示watchdog启动成功
配置sbd fence
创建共享磁盘
# 共享磁盘使用裸设备
查找共享磁盘的id
ls -l /dev/disk/by-id
lrwxrwxrwx 1 root root 9 Aug 6 21:08 scsi-36000c29b96fbda2190b2ffa33080e9ff -> ../../sdd
安装sdb fence_agents-sbd
# 所有节点
yum install sbd
yum install fence-agents-sbd
Prepare the environment
Optional: Initialize shared storage device(s) for sbd
poison-pill fencing via block-device
pcs stonith sbd device setup --device=<device path> [--device=<device path>] [--device=<device path>]
pcs stonith sbd device setup --device=/dev/disk/by-id/scsi-36000c29b96fbda2190b2ffa33080e9ff
WARNING: All current content on device(s) '/dev/disk/by-id/scsi-36000c29b96fbda2190b2ffa33080e9ff' will be overwritten. Are you sure you want to continue? [y/N] y
Initializing device(s) /dev/disk/by-id/scsi-36000c29b96fbda2190b2ffa33080e9ff...
Device(s) initialized successfuly
Enable and configure sbd health and quorum monitoring
Option 1: With *sbd
poison-pill fencing via block-device*
# # Example with a single device:
# pcs stonith sbd enable --device=/dev/disk/by-id/dm-uuid-mpath-360014058b858513c3044413ace481447 [--watchdog=<path>[@<node>]] ... [<SBD_OPTION>=<value>]
#
# # Example with multiple devices:
# pcs stonith sbd enable --device=/dev/disk/by-id/dm-uuid-mpath-360014058b858513c3044413ace481447 --device=/dev/disk/by-id/dm-uuid-mpath-360014058b858513c3044413def1258 --device=/dev/disk/by-id/dm-uuid-mpath-360014058b858513c3044413ber1548 [--watchdog=<path>[@<node>]] ... [<SBD_OPTION>=<value>]
pcs stonith sbd enable --device=/dev/disk/by-id/scsi-36000c29b96fbda2190b2ffa33080e9ff --watchdog=/dev/watchdog
Option 2: Without *sbd
poison-pill fencing via block-device*
# # Syntax: # pcs stonith sbd enable [--watchdog=<path>[@<node>]] ... [<SBD_OPTION>=<value>]
# # Example:
# pcs stonith sbd enable
Configure cluster fence methods
Enable stonith-watchdog-timeout
fencing
Configure the cluster with a greater than 0 value for the cluster property stonith-watchdog-timeout
. This value should be larger than the SBD_WATCHDOG_TIMEOUT
setting configured in the earlier pcs stonith sbd enable
step - which defaults to a value of 5 seconds. If SBD_WATCHDOG_TIMEOUT
was left at the default, this stonith-watchdog-timeout
property can be set to 10s.
# # Example with SBD_WATCHDOG_TIMEOUT=10 (seconds)
pcs property set stonith-watchdog-timeout=10
Optional: Create fence_sbd
STONITH device for *sbd
poison-pill fencing via block-device*
# # Example with single device:
# pcs stonith create sbd fence_sbd devices=/dev/disk/by-id/dm-uuid-mpath-360014058b858513c3044413ace481447
#
# # Example with multiple devices:
# pcs stonith create sbd fence_sbd devices=/dev/disk/by-id/dm-uuid-mpath-360014058b858513c3044413ace481447,/dev/disk/by-id/dm-uuid-mpath-360014058b858513c3044413def1258,/dev/disk/by-id/dm-uuid-mpath-360014058b858513c3044413ber1548
pcs stonith create sbd fence_sbd devices=/dev/disk/by-id/scsi-36000c29b96fbda2190b2ffa33080e9ff
Optional: Configure fence_sbd
device into STONITH levels with any other devices in the cluster
# pcs stonith show --full
Resource: kdump (class=stonith type=fence_kdump)
Attributes: pcmk_host_list="rhel7-node1.example.com rhel7-node2.example.com rhel7-node3.example.com rhel7-node4.example.com"
Operations: monitor interval=60s (kdump-monitor-interval-60s)
Resource: sbd (class=stonith type=fence_sbd)
Attributes: devices=/dev/disk/by-id/dm-uuid-mpath-360014054540864241b04b67af8351a38,/dev/disk/by-id/dm-uuid-mpath-360014058b858513c3044413ace481447,/dev/disk/by-id/dm-uuid-mpath-360014059b3b71fdd6254d519c085050c
Operations: monitor interval=60s (sbd-monitor-interval-60s)
# pcs stonith level add 1 rhel7-node1.example.com kdump
# pcs stonith level add 2 rhel7-node2.example.com sbd
# # [... repeat for all nodes ...]
pcs stonith level add 1 r7-node-1-hb kdump
pcs stonith level add 2 r7-node-1-hb sbd
pcs stonith level add 1 r7-node-2-hb kdump
pcs stonith level add 2 r7-node-2-hb sbd
标签:sbd,fence,pcs,dev,stonith,pacemaker,device,id
From: https://www.cnblogs.com/goldtree358/p/17623218.html