DRBD ==>
:StandAlone ro:Secondary/Unknown ds:UpToDate/DUnknow


node2 set to Secondary ==>

drbdadm secondary all
drbdadm disconnect all
drbdadm -- --discard-my-data connect all

node1 set to Primary ==> 

drbdadm primary all
drbdadm disconnect all
drbdadm connect all

-----------------------------------------------------------------------------------------------------------

 

當DRBD 兩台都為 StandAlone 時,

先將一台設為 Secondary 另一台設為  Primary 

這樣Secondary  就會同步到 Primary 上面了。

 ---------------------------------------------------------------------------------------------------------------------------------

兩台都加入cron 的shell

node 1

cat  /root/drbd_check.sh

 

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

----------------------------------------------------------------

node 2

cat  /root/drbd_check.sh

 

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 node2`
if [ "$info_drbd" == "$info_drbd_no" ]
then
crm_mon -1
else
echo Masters : node1
echo drbd Secondary/Unknown
drbdadm secondary all
drbdadm disconnect all
drbdadm -- --discard-my-data connect all
ssh node1 "drbdadm primary all"
ssh node1 "drbdadm disconnect all"
ssh node1 "drbdadm connect all"
cat /proc/drbd
fi
fi

arrow
arrow
    創作者介紹
    創作者 echochio 的頭像
    echochio

    echochio

    echochio 發表在 痞客邦 留言(0) 人氣()