glusterfs原理问答

  1. 对一个replication 3 卷进行扩展,扩展3个brick之后,数据会自动迁移么?

答:通过 gluster volume add-brick 对一个复制卷进行扩展之后,数据并不会自动迁移。换句话说,新创建的文件依然使用以前的拓扑,依然只在原有的三个brick上分布数据。使用命令

    gluster volume rebalance VOLNAME fix-layout start

后,才会识别到新拓扑。新创建的文件才能在新增加的brick上分布。但是数据并不会自动迁移。使用如下命令才会迁移数据:

       gluster volume rebalance VOLNAME  start

即原有数据向新brick均匀迁移。

       需要注意的是如果卷缩容,即 gluster volume remove-brick,会自动迁移数据。
  1. 在一个replication 3 卷上创建磁盘,创建虚拟机,当其中两个brick挂掉(down)之后,会有什么现象发生?

    答:在ovirt的超融合环境上,虚拟机会暂停。暂停的原因是quorum引起的。

为了防止脑裂,gluster设置了4个卷参数。

(1)

cluster.server-quorum-type server

cluster.server-quorum-ratio 51

这两个参数称为server端的quorum。默认值是server,51. 意思是说,当集群中的网络或者glusterd的数量只有

大于%51时候,才能正常写入。对于3副本,需要有2个副本online,才能进行写操作。

(2)

cluster.quorum-type auto

cluster.quorum-count null

这两个参数成为client 端的quorum。默认值是auto, null.意思是只有副本online数目超过一半时候,才能够写。

避免,多个client分别访问 网络断开后不同的副本组 造成脑裂。

将上述参数如下设置

[root@host11 ~]# gluster volume get vmstore all | grep quorum

cluster.quorum-type fixed

cluster.quorum-count 1

cluster.server-quorum-type server

cluster.server-quorum-ratio 25%

就会发现,即使只有一个副本存活,虚拟机也能正常读写。

上述配置只是用来说明问题。生产环境请不要这样使用。否则会出现脑裂。

  1. AFR是如何处理读写的?

简单讲,对于一个多副本。读数据只会读一个副本,写数据会写三个副本。所以写数据是比较重的。事实上,不但要写三个副本的数据,还要写元数据,以及lock操作。具体细节可以查看参考文献2以及代码。

  1. glusterfs的环境下,可以更改副本数目么?比如一个卷由三副本变成二副本,或者由2副本,变成3副本。

答:可以。但是尽量不要这么做。虽然官方没有明确描述,但是通过如下命令是可以实现的。

gluster volume remove-brick data replica 2 chost12.node16:/gluster_bricks/data/data force

gluster volume add-brick data replica 3 host12.node16:/gluster_bricks/data/data/ force

注意 3变2时候 要带 “replica 2”

同时,2变3时候,要带 “replica 3”

参考文献:

1 . https://docs.gluster.org/en/latest/Administrator%20Guide/Managing%20Volumes/

2 .https://events.static.linuxfound.org/sites/events/files/slides/glusterfs-AFR-LinuxCon_EU-2015_0.pdf

3 .https://access.redhat.com/documentation/en-us/red_hat_gluster_storage/3.4/html/administration_guide/sect-Managing_Split-brain#Configuring_Server-Side_Quorum

人已赞赏
文章

ovirt-engine 接管外部LDAP用户(二): 在ovirt-engine接入OpenLDAP

2020-6-3 16:21:56

文章

glusterfs命令行的小细节

2020-6-4 9:15:42

2 条回复 A文章作者 M管理员
  1. 转自oVirt中文社区

    I agree with your point of view, your article has given me a lot of help and benefited me a lot. Thanks. Hope you continue to write such excellent articles.

  2. 转自oVirt中文社区

    Reading your article helped me a lot and I agree with you. But I still have some doubts, can you clarify for me? I’ll keep an eye out for your answers.

个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索
您好,有任何疑问请与我们联系!