DRBD脑裂解决方法

时间:2023-12-30 23:21:02

1.查看主服务器

[root@master ~]# /etc/init.d/drbd status
drbd driver loaded OK; device status:
version: 8.4. (api:/proto:-)
GIT-hash: 599f286440bd633d15d5ff985204aff4bccffadd build by root@master.luodi.com, -- ::
m:res cs ro ds p mounted fstype
:example StandAlone Primary/Unknown UpToDate/DUnknown r-----
[root@master ~]#

2.查看备服务器

[root@slave ~]# /etc/init.d/drbd status
drbd driver loaded OK; device status:
version: 8.4. (api:/proto:-)
GIT-hash: 599f286440bd633d15d5ff985204aff4bccffadd build by root@master.luodi.com, -- ::
m:res cs ro ds p mounted fstype
:example StandAlone Secondary/Unknown UpToDate/DUnknown r-----
[root@slave ~]#

解决方法:

在备服务器操作:其中example是资源名

[root@slave ~]# drbdadm secondary example
[root@slave ~]# drbdadm --discard-my-data connect example

在主服务器操作

[root@master ~]# drbdadm connect example
[root@master ~]# cat /proc/drbd
version: 8.4. (api:/proto:-)
GIT-hash: 599f286440bd633d15d5ff985204aff4bccffadd build by root@master.luodi.com, -- :: : cs:SyncSource ro:Primary/Secondary ds:UpToDate/Inconsistent C r-----
ns: nr: dw: dr: al: bm: lo: pe: ua: ap: ep: wo:d oos:
[>....................] sync'ed: 4.7% (257728/264412)K
finish: :: speed: , (,) K/sec

备机上查看:DRBD恢复正常

[root@slave ~]# /etc/init.d/drbd status
drbd driver loaded OK; device status:
version: 8.4. (api:/proto:-)
GIT-hash: 599f286440bd633d15d5ff985204aff4bccffadd build by root@master.luodi.com, -- ::
m:res cs ro ds p mounted fstype
:example Connected Secondary/Primary UpToDate/UpToDate C
[root@slave ~]#