The Inuits Fixing a GlusterFS split-brain

I have found some time to test GlusterFS, in order to use it to replicate data between several servers.

I have created two vagrant boxes to set up a basic cluster.

And, during my tests, I have shut down the network interfaces and started writing different things on the same file, to create a split-brain.

srv01$ echo good > /mnt/test
srv02$ echo bad > /mnt/test

When the interfaces were up again, the split-brain was obviously present:

srv02$ cat /mnt/test
cat: /mnt/test: Input/output error

In the logs, I have found the following sentence:

[2013-07-17 13:57:54.156318] E [afr-self-heal-common.c:197:afr_sh_print_split_brain_log]
0-gv0-replicate-0: Unable to self-heal contents of '<gfid:470a742c-b0d6-4846-9ab3-2483c3a0c8da>'
(possible split-brain). Please delete the file from all but the preferred subvolume.-
Pending matrix:  [ [ 0 1 ] [ 1 0 ] ]

So I tried to delete the file in the node that was "wrong" to me:

srv02$ cat /export/brick1/sdb1/test
srv02$ sudo rm /export/brick1/sdb1/test

But it was obviously not working:

srv02$ cat /mnt/test
cat: /mnt/test: Input/output error

Even more, the file /export/brick1/sdb1/test was recreated by Gluster!

srv02$ cat /export/brick1/sdb1/test
wrong

The solution was the following: Gluster is creating hard links in a .gluster directory, and you have to delete all the hard links to the file to get rid of it.
Please note that I am working on the 'brick'.

srv02$ sudo find /export/brick1/sdb1/ -samefile /export/brick1/sdb1/test -print -delete
/export/brick1/sdb1/.glusterfs/47/0a/470a742c-b0d6-4846-9ab3-2483c3a0c8da
/export/brick1/sdb1/test

And it worked!

srv02$ cat /mnt/test
good
srv02$ cat /export/brick1/sdb1/test
good

Additional notes

Only the files that were "brain-splitted" were unreadable.

You can have the list of these files by running the following command:

$ gluster volume heal gv0 info
Brick 192.168.1.10:/export/brick1/sdb1
Number of entries: 1
/test

Brick 192.168.1.11:/export/brick1/sdb1
Number of entries: 1
/test

To avoid split-brains, you can enable quorums.

转自:https://inuits.eu/blog/fixing-glusterfs-split-brain

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值