drdb脑裂分析解决

联系:手机/微信(+86 17813235971) QQ(107644445)QQ咨询惜分飞

标题:drdb脑裂分析解决

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

1、脑裂原因
1.1)drdb两边的磁盘数据不一致,并且不知道自动恢复,举例说明产生该现象原因:
a是从节点、b是主节点
1.1.1)a节点磁盘不能正常写入数据(磁盘、主机、网络等原因)
1.1.2)a、b两个节点角色发生改变(a为主节点,b磁盘不可用,两边的数据未一致),a中对磁盘进行了操作
1.1.3)此时b磁盘恢复可用,但是因为a、b磁盘不一致,出现脑裂
1.2)官方描述
DRBD detects split brain at the time connectivity becomes available again and the peer nodes exchange the initial DRBD protocol handshake. If DRBD detects that both nodes are (or were at some point, while disconnected) in the primary role, it immediately tears down the replication connection. The tell-tale sign of this is a message like the following appearing in the system log:
Split-Brain detected, dropping connection!

2、出现脑裂的现象
2.1)开机界面

2.2)进入系统查看drdb状态
2.2.1)备节点
[root@node1 ~]# cat /proc/drbd
version: 8.3.8 (api:88/proto:86-94)
GIT-hash: d78846e52224fd00562f7c225bcc25b2d422321d build by mockbuild@builder10.centos.org, 2010-06-04 08:13:40
0: cs:StandAlone ro:Secondary/Unknown ds:UpToDate/DUnknown r—-
ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:620
2.2.2)主节点
[root@node1 ~]# service drbd status
drbd driver loaded OK; device status:
version: 8.3.8 (api:88/proto:86-94)
GIT-hash: d78846e52224fd00562f7c225bcc25b2d422321d build by mockbuild@builder10.centos.org, 2010-06-04 08:13:40
m:res cs ro ds p mounted fstype
0:r0 StandAlone Secondary/Unknown UpToDate/DUnknown r—-

3、处理脑裂
需要选择一个节点为主节点(本实验选择node2为主节点)
3.1)从节点上
[root@node1 ~]# drbdadm secondary r0
[root@node1 ~]# drbdadm — –discard-my-data connect r0
[root@node1 ~]# cat /proc/drbd
version: 8.3.8 (api:88/proto:86-94)
GIT-hash: d78846e52224fd00562f7c225bcc25b2d422321d build by mockbuild@builder10.centos.org, 2010-06-04 08:13:40
0: cs:WFConnection ro:Secondary/Unknown ds:UpToDate/DUnknown C r—-
ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:620
3.2)主节点,通过cat /proc/drbd查看状态,如果不是WFConnection状态,需要再手动连接
[root@node2 ~]# drbdadm connect r0

4、再次查看drdb状态
4.1)查看从节点
[root@node1 ~]# cat /proc/drbd
version: 8.3.8 (api:88/proto:86-94)
GIT-hash: d78846e52224fd00562f7c225bcc25b2d422321d build by mockbuild@builder10.centos.org, 2010-06-04 08:13:40
0: cs:Connected ro:Secondary/Primary ds:UpToDate/UpToDate C r—-
ns:0 nr:1156 dw:1156 dr:0 al:0 bm:16 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:0
4.2)查看主节点
[root@node2 ~]# service drbd status
drbd driver loaded OK; device status:
version: 8.3.8 (api:88/proto:86-94)
GIT-hash: d78846e52224fd00562f7c225bcc25b2d422321d build by mockbuild@builder10.centos.org, 2010-06-04 08:13:40
m:res cs ro ds p mounted fstype
0:r0 Connected Primary/Secondary UpToDate/UpToDate C /opt/mysql ext3
通过查看drbd状态发现,脑裂问题解决,node1中的数据和node2中的相同

此条目发表在 Linux高可用 分类目录。将固定链接加入收藏夹。

评论功能已关闭。