Chinaunix首页 | 论坛 | 博客
  • 博客访问: 68346
  • 博文数量: 16
  • 博客积分: 55
  • 博客等级: 民兵
  • 技术积分: 78
  • 用 户 组: 普通用户
  • 注册时间: 2011-12-22 10:22
文章分类
文章存档

2014年(1)

2013年(3)

2012年(12)

分类: 服务器与存储

2013-12-19 16:18:16

原文地址:解读glusterfs的vol文件 作者:reesun

Volume文件就像是glusterfs的配置文件,这个文件能够定义glusterfs的布局,控制glusterfs的动作。编写volume文件是高级开发人员的工作。

vol文件中,每个volume选择一个适当的tanslator模块和与之相关的配置操作。通过vol文件中translator和模块的配置信息,你可以完全的控制glusterfs。由于这个灵活的机制使glusterfs适应不同存储的要求。

目录

Vol 语法

  • "#" 是解释符号.
  • Volume 文件对大小写敏感.
  • volume段中操作的顺序不唯一.
  • Spaces(空格键) or tabsTab键) 在一行中被用作分隔符.
  • 每个操作占用一行. (no '\n')
  • 缺失和被注释掉的域被赋予默认值.
  • 允许有空行和注释行.
  • Sub-volumes 应该在被引用前定义 .

Vol 文件实例

下面看一下编写vol文件的命名规则

volume client

 type protocol/client

#  option remote-port 7000

 option transport-type tcp

 option remote-host localhost

 option remote-subvolume brick

end-volume

 

volume iothreads

 type performance/io-threads

 option thread-count 4

 subvolumes client

end-volume

 

volume writeback

 type performance/write-behind

 subvolumes iothreads

end-volume

 

# volume trace

#  type debug/trace

#  subvolumes writeback

# end-volume

在这个例子中, 'volume client' 'volume iothreads'之前定义, 'volume iothreads' 'volume writeback'之前被定义. 但是在使用时,fuse先用到'volume writeback', 'volume client' 最后一个被用到.每个volumes的顺序是自下而上的.

单个volume

1  volume unify

2    type cluster/distribute

3    option scheduler rr                    # check alu, random, nufa

4    option rr.limits.min-free-disk 5       # 5% of free disk is minimum.

5    option namespace namespace-child

6    subvolumes child1 child2 child3 child4 # client[1-n], n < 32bit number :D

7  end-volume

逐行解释

注:行首的数字是用作引用的,在真正的文件中没有这些数字.

  • 1"volume unify"

这里的 'volume' 是语法分析器的标示符, 用来声明一个新的translator. 'unify' volume的名字, 这个在vol文件中师唯一的. Volume段是可以随意命名的,但是其名字最好能够说明这个段的意义.

  • 2"type cluster/distribute"

这里 'type' 是语法分析器的标示符, 用来查找translator的类型(请在wiki中查找类型的说明). 'cluster/distribute' 是查阅在lib目录中目标文件的路径: "//glusterfs//xlator/cluster/distribute.so".

可以看出,glusterfs中每个tanslator是在运行时通过特定文件加载的,所以glusterfs的行为是通过vol文件控制的.

  • 3"option scheduler rr"
  • 4"option rr.limits.min-free-disk 5"
  • 5"option namespace namespace-child"

这里 'option' 是语法分析器的标示符, 用来定义tanslator的特定的操作. 'option' 需要两个参数:'key', 'value' ('option key value'). 这些操作对于不同的translator而不同.

'scheduler' translator的一个操作, 它定义在创建文件时使用何种调度方式. Glusterfs的调度算法比较少,所以可以去wiki查看更多信息.

'rr' 是调度算法的一种('rr' means round-robin). 还有其它算法,如: 'alu', 'random', 'nufa'.

  • 6"subvolumes child1 child2 child3 child4"

'subvolumes' 是创建translator树的关键字. 使用 'subvolumes' 关键字可以定义那个translator会在这个translator后被加载. 所有的cluster translators 有一个或多个subvolumes, 而别的translators 仅有一个subvolume. 这个关键字不会再叶translator上使用. 这些叶translator 'storage/posix' 'protocol/client'.

  • LINE 7: "end-volume"

这里 'end-volume' 表示所定义的 'volume unify' translator结束.

进一步阅读

"GlusterFS_1.2_Configuration_Example_for_Four_Bricks" tutorial written by Julien Perez gives a very nice understanding of volume file and its pictorial representation. The volume file options may be bit older, but still is a nice article to understand the GlusterFS volume file.

编辑vol文件工具

参考

  • Translators page gives an insight about each translators available in GlusterFS.
  • Translators options gives a list of all the existing translator options.
阅读(3797) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~