glusterfs源码框架分析01

GLUSTERFS
源 码 框 架 分 析01

目录

1 GlusterFS GlusterFS 概括
1.1 glusterFS
源码目录分析
1.2 glusterFS
工作时各个应用程序之间联系分析
1.3 glusterFS
cli,deamon,server,client ) 四方架构图
1.4
架构图注释
2 GlusterFS
damon 
3 GlusterFS
server
4 GlusterFS
client
5.
总结


1 GlusterFS GlusterFS 概括

1.1 glusterFS 源码目录分析
glusterFS 为一分布式文件系统,从源码组织分析其目录结构为:

a. argp-standalone 文件夹内容为命令行参数解析库,为调用应用程序传进来参数解析提供库函数。

b. cli 文件夹为命令行接口(command line interface)应用程序,调用该程序执行glusterfs 的相关操作命令。

c. contrib 文件夹里面包含用到得第三方库源码。例如 MD5fuseuuid 等。

d. doc 文件夹为 glusterFS 的一些文档和配置 example。

e. extras 文件夹包含 glusterFS 配置的一些脚本信息。

f. glusterfsd 文件夹包含了 glusterfsd 工程的相关源码和 Makefile 信息,其用到了文件夹 libglusterfs 提供的库函数,并根据卷配置信息动态载入(dlopendlsymxlator文件夹提供的相关 translator 库。

g. libglusterfs 为一库工程,为 glusterfsd 以及 xlator 下的相关 translator 提供库函数。

h. xlators 文件夹包含所有用到的 translator 库。下面根据类型又分为 cluster debug performance mgmt 等子文件夹。 glusterFS 各个应用程序根据自己的卷配置信息动态载入相关的 translator 库。例如 glusterd 应用程序只载入 mgmt 根据默认卷配置

信息: /usr/local/etc/glusterfs/glusterd.vol。

i. rpc 文件夹包含 gluserFs 应用程序之间通信用到的库函数。例如 socket 监听和连接等操作。

j. configure.ac 文件为根据 autoscan 生成信息修改而成的配置信息。生成 configure 需用到该脚本。如果向该 glusterFS 添加子工程需要动态修改该配置信息。

k. autogen.sh 为一脚本文件,该脚本利用 automake 等工具生成 configure 执行脚本。 运行时候需要安装 pkg-config 应用程序。


1.2 glusterFS 工作时各个应用程序之间联系分析

GlusterFS工作时候共有四种应用程序需要运行,它们分别是 glusterglusterdglusterfsdglusterfs,其中 glusterdglusterfs glusterfsd 的链接文件,通过修改该应用程序名称,来区分不同的功能(代码内部根据执行文件名称走不同函数流程)。

agluster cli,即命令行执行工具,该应用负责把对 glusterFS 的操作请求发送到glusterd 上去执行。

bglusterd damon 程序,该 damon 负责接收 gluster 发送过来的操作请求,并执行相关的操作,例如调用 glusterfsd 启动 brick 服务。

cglusterfsd 为服务进程,由 glusterd 启动。根据卷配置信息执行由 glusterfs 发送过来的请求。 通过 rpc 连接 glusterd 获取该服务的卷信息

dglusterfs 为客户端程序。根据卷配置信息将 fuse 过来的操作请求逐层专递到最底层protocol/client translater 上,该 translater 通过 RPC glusterfsd 连接,将请求发送到 glusterfsd 服务端继续执行。 通过 rpc 连接 glusterd 获取该服务的卷信息。

1.3 glusterFScli,deamon,server,client ) 四方架构图



1.4 架构图注释

该构架图描述了 glusterFS 的通信结构图,每个应用程序通过 RPC socket )与其他应用
程序进行通信。 图中
listen port 为应用程序创建的 sokcet 监听端口, connet port 为连接其他

应用程序的 listen port 的端口。

1.     1 号线为 CLI gluserd 之间 command 连接,通过该连接 cli gluserd 发送命令,

gluserd 执行譬如 peercreatestart 等命令。


2.     2 号和 3 号线为为不同 host gluserd 之间的连接,用来同步命令等相关操作。


3.     4 号, 5 号, 6 号线为服务端 gluserfsd 与同一 host 端的 glusterd 的连接,用来从 glusterd

获取该服务对应的服务端卷信息。 例如: hello.vm-pool-3.home-test1.vol。

4.     7 号线为客户端 glusterFS 与命令操作 host glusterd 之间的连接,用来获取该客户端

对应的客户端卷文件信息,例如: hello-fuse.vol。

5.     8 号, 9 号, 10 号线为 protocol/client server translator 的连接,每个 brick
个连接,用来执行相应的文件操作。



  • 5
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值