I try is ok ===>
--------------------------------------------------------------------------------------------
[root@node1 ~]# more drbd_check.sh
#!/bin/bash
info_drbd=`cat /proc/drbd |grep Secondary |grep Unknown`
info_drbd_no=""
if [ "$info_drbd" == "$info_drbd_no" ]
then
cat /proc/drbd|grep Primary
echo ok
else
info_drbd_node=`crm_mon -1 |grep Masters |grep node1`
if [ "$info_drbd" == "$info_drbd_no" ]
then
crm_mon -1
else
echo Masters : node2
echo drbd Secondary/Unknown
drbdadm secondary all
drbdadm disconnect all
drbdadm -- --discard-my-data connect all
ssh node2 "drbdadm primary all"
ssh node2 "drbdadm disconnect all"
ssh node2 "drbdadm connect all"
cat /proc/drbd
fi
fi
----------------------------------------------------------
[root@node2 ~]# cat /root/drbd_check.sh
#!/bin/bash
info_drbd=`cat /proc/drbd |grep Secondary |grep Unknown`
info_drbd_no=""
if [ "$info_drbd" == "$info_drbd_no" ]
then
cat /proc/drbd|grep Primary
echo ok
else
info_drbd_node=`crm_mon -1 |grep Masters |grep node1`
if [ "$info_drbd" == "$info_drbd_no" ]
then
crm_mon -1
else
echo Masters : node2
echo drbd Secondary/Unknown
drbdadm secondary all
drbdadm disconnect all
drbdadm -- --discard-my-data connect all
ssh node2 "drbdadm primary all"
ssh node2 "drbdadm disconnect all"
ssh node2 "drbdadm connect all"
cat /proc/drbd
fi
fi
----------------------------------------------------------------
[root@node1 ~]# chmod +x /root/drbd_check.sh
[root@node2 ~]# chmod +x /root/drbd_check.sh
-----------------------------------------------------------------
handlers {
split-brain "/root/drbd_check.sh root";
........
}
net {
after-sb-0pri disconnect;
after-sb-1pri discard-secondary;
after-sb-2pri disconnect;
.......
}
留言列表