千家信息网

GlusterFS是什么意思

发表于:2024-09-30 作者:千家信息网编辑
千家信息网最后更新 2024年09月30日,这篇文章主要介绍了GlusterFS是什么意思,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。一、GlusterFS相关概念:Glust
千家信息网最后更新 2024年09月30日GlusterFS是什么意思

这篇文章主要介绍了GlusterFS是什么意思,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。

一、GlusterFS相关概念:

GlusterFS 是一个开源的分布式文件系统,同时也是Scale-Out存储解决方案Gluster的核心,在存储数据方面有强大的横向扩展能力。GlusterFS主要由存储服务器、客户端及NFS/Samba存储网关(可选组件)组成。GlusterFS架构中最大的设计特点是没有元数据服务器组件,也就是说没有主/从服务器之分,每一个节点都可以是主服务器。
.
1、Gluster相关参考文档如下(我下面的配置是基于本地yum配置的,若需要搭建最新版本,可直接按照下面的文档链接进行配置):
.
Gluster官网 :https://wiki.centos.org/SpecialInterestGroup/Storage/gluster-Quickstart
基于centos7/Redhat安装Gluster官方文档:https://blog.csdn.net/daydayup_gzm/article/details/52748812
.
2、 GlusterFS相关术语:
.

Brick(存储块):指可信主机池中由主机提供的用于物理存储的专用分区。
Volume(逻辑卷):一个逻辑卷是一组Brick的集合。卷是数据存储的逻辑设备。
FUSE:是一个内核模块,允许用户自己创建文件系统,无须修改内核代码。
Glusterd(后台管理进程):在存储群集中的每个节点上都要运行。
VFS:内核空间对用户空间提供的访问磁盘的接口。

3、GlusterFS的卷类型:

  • 分布式卷:相当于Windows中的跨区卷,只是扩大了磁盘空间,不具有容错能力;

  • 条带卷:相当于Windows中的带区卷,属于RAID 0级别,一份文件会在多个磁盘上进行读写,文件越大,读写效率越高,但不具有容错能力;

  • 复制卷:相当于Windows中的镜像卷,属于RAID 1级别,具有容错能力,读性能高,但写性能下降,因为要将同一份文件同步写入在多个Brick上。

  • 分布式条带卷:brick server数量是条带数(数据块分布的brick数量)的倍数,兼具分布式卷和条带卷的特点。

  • 分布式复制卷:brick server数量是镜像数(数据副本数量)的倍数,兼具分布式卷和复制卷的特点。

  • 条带复制卷:类似于RAID 10,同时具备条带卷和复制卷的特点。

  • 分布式条带复制卷:三种基本卷的复合卷,通常用于map reduce应用。
    在以上几种卷类型中,有些可能无法理解透彻,但是没关系,在生产环境中,大多数公司考虑到磁盘的利用率,会使用RAID5,或者RAID 10,关于RAID 5卷的配置可以参考:GlusterFS Dispersed Volume(纠错卷)总结。

4、下面介绍GlusterFS一些卷类型的特点(不包括RAID5):

1、分布式卷(类似Windows中的跨区卷):
.
分布式卷是GlusterFS的默认卷,在创建卷时,默认选项是创建分布式卷。在该模式下,并没有对文件进行分块处理,文件直接存储在某个server节点上。
.
分布式卷具有如下特点:
.

1、文件分布在不同的服务器,不具备冗余性。
2、更容易且廉价地扩展卷的大小。
3、单点故障会造成数据丢失。
4、依赖底层的数据保护。

2、条带卷(类似Windows中的带区卷,也称为RAID 0):
.
stripe模式相当于RAID 0,在该模式下,根据偏移量将文件分成N块(N个条带节点),轮询地存储在每个Brick Server节点。节点把每个数据块都作为普通文件存入本地文件系统,通过扩展属性记录总块数和每块的序号。在配置时指定条带数必须等于卷中Brick 所包含的存储服务器数,在存储大文件时,性能尤为突出,但是不具备冗余性。
.
条带卷具有如下特点:
.

1、数据被分割成更小块分布到块服务器群中的不同条带区。
2、分布减少了负载且更小的文件加速了存取的速度。
3、没有数据冗余。

3、复制卷(类似于Windows中的镜像卷,也称为RAID 1)
.
复制模式,即同一文件保存一份或多份副本,每个节点上保存相同的内容和目录结构。复制模式因为要保存副本,所以磁盘利用率较低,如果多个节点上的存储空间不一致,那么将按照木桶效应取最低节点的容量作为该卷的总容量。复制卷具有冗余性,即使一个节点损坏,也不影响数据的正常使用。
.
复制卷具有如下特点:

1、卷中所有的服务器均保存一个完整的副本。
2、卷的副本数量可由客户创建的时候决定。
3、至少有两个块服务器或更多服务器。
4、具备冗余性。
4、分布式复制卷(也称为RAID 10):

分布式复制卷兼顾分布式卷和复制卷的功能,主要用于需要冗余的情况下。
.
二、GlusterFS各种卷类型的部署及客户端挂载使用:
.
环境如下:

相关信息:

磁盘挂载信息:

.
准备工作:
1、在所有节点上进行操作:根据上表中添加磁盘,通过fdisk命令进行分区,mkfs格式化,创建相应的挂载目录,并将格式化的磁盘挂载到相应的目录中,最后修改/etc/fstab配置文件,使其永久挂载。
可参考博文:https://blog.51cto.com/14154700/2350748
2、配置防火墙放行流量
3、本地yum仓库:https://pan.baidu.com/s/1ZzURDjGsue7cPnVPdKFCvA (提取码:309q)
开始部署:
.
node1的配置:

配置hosts文件[root@node1 /]# vim /etc/hosts                 # 添加四个节点的解析...............      //  省略部分内容192.168.1.10    node1192.168.1.20    node2192.168.1.30    node3192.168.1.40    node4[root@node1 /]# mount /dev/sr0 /media/           # 挂在本地yum仓库mount: /dev/sr0 is write-protected, mounting read-only[root@node1 /]# rm -rf /etc/yum.repos.d/*         #删除原有yum配置文件(或者移走也行)[root@node1 /]# vim /etc/yum.repos.d/a.repo           # 编写yum配置文件[yum]baseurl=file:///mediagpgcheck=0[root@node1 /]# yum -y install glusterfs glusterfs-server glusterfs-fuse glusterfs-rdma      # yum安装 gluster,所有节点都需要做[root@node1 /]# systemctl start glusterd                  # 启动服务[root@node1 /]# systemctl enable glusterd

node2的配置:
.
因为所有节点大部分配置都是相同的,所以我们可以使用scp命令来将配置好的节点文件复制来使用

[root@node2 /]# scp root@192.168.1.10:/etc/hosts /etc/              # 将hosts解析文件复制过来The authenticity of host '192.168.1.10 (192.168.1.10)' can't be established.ECDSA key fingerprint is 68:df:0f:ac:c7:75:df:02:88:7d:36:6a:1a:ae:27:23.Are you sure you want to continue connecting (yes/no)? yesWarning: Permanently added '192.168.1.10' (ECDSA) to the list of known hosts.root@192.168.1.10's password:             # 输入密码hosts                                                100%  234     0.2KB/s   00:00    [root@node2 /]# rm -rf /etc/yum.repos.d/*[root@node2 /]# scp root@192.168.1.10:/etc/yum.repos.d/* /etc/yum.repos.d/root@192.168.1.10's password: a.repo                                               100%   39     0.0KB/s   00:00    [root@node2 /]# mount /dev/sr0 /media                   # 挂载yum仓库[root@node2 /]# yum -y install glusterfs glusterfs-server glusterfs-fuse glusterfs-rdma     # 安装软件[root@node2 /]# systemctl start glusterd          # 启动服务[root@node2 /]# systemctl enable glusterd

node3和node4照着node2配置操作就可以
.
添加节点(接下来的所有配置,在任意一台节点上执行都可以,我这里在node1上执行):

[root@node1 /]# gluster peer probe node1peer probe: success. Probe on localhost not needed             # 表示当前就在node1上,已经存在,不需要再添加了[root@node1 /]# gluster peer probe node2peer probe: success. [root@node1 /]# gluster peer probe node3peer probe: success. [root@node1 /]# gluster peer probe node4peer probe: success. [root@node1 /]# gluster peer status             # 添加完毕后查看群集状态Number of Peers: 3Hostname: node2Uuid: b25b967a-0ec6-4e2e-841f-b13368ec6d73State: Peer in Cluster (Connected)             #如果某个节点显示Disconnected,请检查hosts配置文件Hostname: node3Uuid: 3ce5c3aa-c1da-4112-825d-998e71220423State: Peer in Cluster (Connected)Hostname: node4Uuid: 0c543cae-ec0c-4249-8600-605e0f552b11State: Peer in Cluster (Connected)

创建卷:
1、创建分布式卷:

[root@node1 /]# gluster volume create dis-volume node1:/e6 node2:/e6 force        # force:强制      ; 其中"dis-volume"为卷名,没有指定类型,默认创建的是分布式卷。volume create: dis-volume: success: please start the volume to access data[root@node1 /]# gluster volume info dis-volume             # 查看该卷相关信息,通过修改卷名也可以查看其它卷的信息Volume Name: dis-volumeType: DistributeVolume ID: 09a6443c-a544-475d-9084-28892ce0093fStatus: StartedSnapshot Count: 0Number of Bricks: 2Transport-type: tcpBricks:Brick1: node1:/e6Brick2: node2:/e6Options Reconfigured:transport.address-family: inetnfs.disable: on[root@node1 /]# gluster volume start dis-volume             # 启用该卷volume start: dis-volume: success

2、创建条带卷:

[root@node1 /]# gluster volume create stripe-volume stripe 2 node1:/d5 node2:/d5 forcevolume create: stripe-volume: success: please start the volume to access data#创建条带卷,指定条带卷的个数为2个。"stripe-volume"为卷名#指定类型为stripe,数值为2,而且后面跟了2个brick  server,所以创建的是条带卷[root@node1 /]# gluster volume start stripe-volume                    # 启用该卷volume start: stripe-volume: success

3、创建复制卷:

[root@node1 /]# gluster volume create rep-volume replica 2 node3:/d5 node4:/d5 forcevolume create: rep-volume: success: please start the volume to access data#指定类型为"replica",数值为"2",而且后面跟了两个brick server,所以创建的是复制卷[root@node1 /]# gluster volume start  rep-volume              # 启用该卷volume start: rep-volume: success

4、创建分布式条带卷:

[root@node1 /]# gluster volume create dis-stripe stripe 2 node1:/b3 node2:/b3 node3:/b3 node4:/b3 forcevolume create: dis-stripe: success: please start the volume to access data#指定类型为stripe,数值为2,而且后面跟了4个brick server,所以创建的是分布式条带卷[root@node1 /]# gluster volume start dis-stripe               # 启用volume start: dis-stripe: success

5、创建分布式复制卷:

[root@node1 /]# gluster volume create dis-rep replica 2 node1:/c4 node2:/c4 node3:/c4 node4:/c4 forcevolume create: dis-rep: success: please start the volume to access data#指定类型为replica,数值为2,而且后面跟了4个brick  server,是2的两倍,所以创建的是分布式复制卷[root@node1 /]# gluster volume start dis-repvolume start: dis-rep: success

至此需要的卷就创建完毕了。
.
部署 Gluster 客户端:
.
1、安装客户端软件

[root@client /]# rm -rf /etc/yum.repos.d/*[root@client /]# scp root@192.168.1.10:/etc/yum.repos.d/* /etc/yum.repos.d/root@192.168.1.10's password: a.repo                                               100%   39     0.0KB/s   00:00  # 挂载本地yum仓库[root@client /]# yum -y install glusterfs glusterfs-fuse            # yum安装客户端

2、创建挂载目录:

[root@client /]# mkdir -p /test/{dis,stripe,rep,dis_and_stripe,dis_and_rep}[root@client /]# ls /test/dis  dis_and_rep  dis_and_stripe  rep  stripe

3、修改hosts文件:(直接scp复制也可以)

[root@client /]# scp root@192.168.1.10:/etc/hosts /etc/The authenticity of host '192.168.1.10 (192.168.1.10)' can't be established.ECDSA key fingerprint is 68:df:0f:ac:c7:75:df:02:88:7d:36:6a:1a:ae:27:23.Are you sure you want to continue connecting (yes/no)? yesdWarning: Permanently added '192.168.1.10' (ECDSA) to the list of known hosts.root@192.168.1.10's password: hosts                                                100%  234     0.2KB/s   00:00  [root@client /]# cat /etc/hosts..................              // 省略部分192.168.1.10    node1192.168.1.20    node2192.168.1.30    node3192.168.1.40    node4

4、挂载 Gluster 文件系统:

[root@client /]# mount -t glusterfs node1:dis-volume /test/dis[root@client /]# mount -t glusterfs node1:stripe-volume /test/stripe[root@client /]# mount -t glusterfs node1:rep-volume /test/rep/[root@client /]# mount -t glusterfs node1:dis-stripe /test/dis_and_stripe/[root@client /]# mount -t glusterfs node1:dis-rep /test/dis_and_rep/[root@client /]# df -h              # 查看挂载信息,如果挂载不成功,请检查hosts解析文件文件系统             容量  已用  可用 已用% 挂载点.................          // 省略部分node1:dis-volume      12G   65M   12G    1% /test/disnode1:stripe-volume   10G   65M   10G    1% /test/stripenode1:rep-volume     5.0G   33M  5.0G    1% /test/repnode1:dis-stripe      12G  130M   12G    2% /test/dis_and_stripenode1:dis-rep        8.0G   65M  8.0G    1% /test/dis_and_rep

5、修改fstab文件,设置自动挂载:

[root@client /]# vim /etc/fstab ..................              // 省略部分node1:stripe-volume     /test/stripe    glusterfs       defaults,_netdev 0 0node1:rep-volume        /test/rep       glusterfs       defaults,_netdev 0 0node1:dis-stripe        /test/dis_and_stripe    glusterfs       defaults,_netdev 0 0node1:dis-rep           /test/dis_and_rep       glusterfs       defaults,_netdev 0 0node1:dis-volume        /test/dis       glusterfs       defaults,_netdev 0 0

GlusterFS维护命令:

[root@node1 /]# gluster volume list             // 查看卷的列表dis-repdis-stripedis-volumerep-volumestripe-volume
[root@node1 /]# gluster volume info                  // 查看所有卷的信息Volume Name: dis-repType: Distributed-ReplicateVolume ID: f57c0228-4a5f-4995-8fac-87f9bc034c33Status: StartedSnapshot Count: 0Number of Bricks: 2 x 2 = 4Transport-type: tcpBricks:Brick1: node1:/c4Brick2: node2:/c4Brick3: node3:/c4Brick4: node4:/c4Options Reconfigured:transport.address-family: inetnfs.disable: on................            // 省略部分
[root@node1 /]# gluster volume status                  // 查看卷的状态Status of volume: dis-repGluster process                             TCP Port  RDMA Port  Online  Pid------------------------------------------------------------------------------Brick node1:/c4                             49155     0          Y       13656Brick node2:/c4                             49155     0          Y       13443Brick node3:/c4                             49154     0          Y       13480Brick node4:/c4                             49154     0          Y       13334Self-heal Daemon on localhost               N/A       N/A        Y       13676Self-heal Daemon on node2                   N/A       N/A        Y       13463Self-heal Daemon on node4                   N/A       N/A        Y       13354Self-heal Daemon on node3                   N/A       N/A        Y       13500Task Status of Volume dis-rep------------------------------------------------------------------------------
[root@node1 ~]# gluster volume stop dis-stripe             #停止一个卷Stopping volume will make its data inaccessible. Do you want to continue? (y/n) yvolume stop: dis-stripe: success[root@node1 ~]# gluster volume delete dis-stripe           #删除一个卷Deleting volume will erase all information abe. Do you want to continue? (y/n) yvolume delete: dis-stripe: success[root@node1 ~]# gluster volume set dis-rep auth.allow 192.168.1.*,10.1.1.*            #设置只允许特定网段的客户端访问卷dis-repvolume set: success

感谢你能够认真阅读完这篇文章,希望小编分享的"GlusterFS是什么意思"这篇文章对大家有帮助,同时也希望大家多多支持,关注行业资讯频道,更多相关知识等着你来学习!

文件 分布式 条带 节点 配置 存储 服务 数据 服务器 类型 特点 磁盘 客户 信息 冗余 客户端 副本 数量 模式 系统 数据库的安全要保护哪些东西 数据库安全各自的含义是什么 生产安全数据库录入 数据库的安全性及管理 数据库安全策略包含哪些 海淀数据库安全审计系统 建立农村房屋安全信息数据库 易用的数据库客户端支持安全管理 连接数据库失败ssl安全错误 数据库的锁怎样保障安全 收钱码软件开发 东莞软件开发定制公司 拯救者数据库系统概论 wmi 网络安全中什么意思 手机方面的网络安全 我的世界服务器回城 呼和浩特网络安全实战特训营 数据库字主健自增 民航售票管理数据库 三级网络技术考试系统 我的世界数据库背包数据异常 嵌入式软件开发系统 当前数据库的一些主流技术 我的世界服务器管理者 网络安全服务有限公司 从业网络安全行业必备知识 万方数据库收录的论文有DOI吗 真正网络安全龙头2020 炉石传说手游可以开通服务器吗 pubg显示当前服务器繁忙 南京富凯网络技术有限公司电话 收钱码软件开发 教育系统数据库建设情况 塔科夫就剩下几个服务器 云服务器能翻墙吗 网络安全不容忽视专家来科普 崩坏三不同服务器拜师 陕西智能养老软件开发电话 小学生网络安全辩论会 我的世界服务器怎么做单方块生存
0