我有以下结构:
- 2 个节点。
- corosync + pacemaker + DRBD + OCFS2。
==============
测试网络失败后,DRBD 的状态变为:
****主要/未知****
dmesg 显示以下内容:
检测到裂脑但尚未解决,导致连接中断。
我可以通过命令手动将状态从 DRBD 恢复到 Primary/primary,但我希望自动实现。
我的配置是: /etc/corosync/r0
resource r0 {
protocol C;
startup {
become-primary-on both;
}
disk {
on-io-error detach;
fencing resource-only;
resync-rate 1000M;
}
handlers {
split-brain "/usr/lib/drbd/notify-split-brain.sh root";
fence-peer "/usr/lib/drbd/crm-fence-peer.sh";
after-resync-target "/usr/lib/drbd/crm-unfence-peer.sh";
}
net {
allow-two-primaries yes;
cram-hmac-alg sha1;
shared-secret "DRBD Super Secret Password";
timeout 180;
ping-int 3;
ping-timeout 9;
allow-two-primaries;
after-sb-0pri discard-zero-changes;
after-sb-1pri discard-secondary;
after-sb-2pri disconnect;
}
on node01 {
device /dev/drbd0;
address 192.168.64.128:7788;
meta-disk internal;
disk /dev/mapper/SSDVolume-VMData;
}
on node02 {
device /dev/drbd0;
address 192.168.64.129:7788;
meta-disk internal;
disk /dev/mapper/SSDVolume-VMData;
}
}
我的 crm 配置显示是:
primitive drbd_r0 ocf:linbit:drbd \
params drbd_resource=r0 \
op monitor interval=20 role=Master timeout=30 \
op monitor interval=30 role=Slave timeout=40
primitive filesys Filesystem \
params device="/dev/drbd0" directory="/vmstore" fstype=ocfs2
options="rw,noatime" \
op start interval=0 timeout=60 \
op stop interval=0 timeout=60
primitive virtual_ip IPaddr2 \
params ip=192.168.38.10 cidr_netmask=32 \
op monitor interval=10s \
meta migration-threshold=10
ms ms_drbd_r0 drbd_r0 \
meta master-max=2 master-node-max=1 notify=true
clone filesys_clone filesys \
meta interleave=true
colocation col_filesys_clone-on-drbd_master inf: filesys_clone
ms_drbd_r0:Master
order filesys_clone-after-drbd_master inf: ms_drbd_r0:promote
filesys_clone:start
property cib-bootstrap-options: \
have-watchdog=false \
dc-version=1.1.14-70404b0 \
cluster-infrastructure=corosync \
cluster-name=debian \
stonith-enabled=false \
no-quorum-policy=ignore
rsc_defaults rsc-options: \
resource-stickiness=100
我的问题是:
我应该怎么做才能自动再次从 DRBD Primary/primary 获取状态?
先谢谢了
答案1
在双主模式下运行 DRBD 时,复制网络的任何中断都会导致脑裂。您需要按照此处用户指南中的步骤手动解决此问题:https://docs.linbit.com/doc/users-guide-84/s-resolve-split-brain/
更重要的是,您在没有 STONITH 和隔离的情况下以双主模式运行 DRBD。这很危险,最终会让您失败。您将丢失数据或损坏数据。不建议也不支持这样使用 DRBD。
祝你好运!