GFS基础配置安装(纯实战)
发表于:2026-11-02 作者:千家信息网编辑
千家信息网最后更新 2026年11月02日,GFS基础配置安装基本概述 GFS是一个可扩展的分布式文件系统,用于大型的、分布式的、对大量数据进行访问的应用。它运行于廉价的普通硬件上,并提供容错功能。它可以给大量的用户提供总体性能较高的服务。基
千家信息网最后更新 2026年11月02日GFS基础配置安装(纯实战)
GFS基础配置安装
基本概述
GFS是一个可扩展的分布式文件系统,用于大型的、分布式的、对大量数据进行访问的应用。它运行于廉价的普通硬件上,并提供容错功能。它可以给大量的用户提供总体性能较高的服务。
基本结构图
基本部署步骤
一、实验准备
| 名称 | 角色 | IP地址 |
|---|---|---|
| centos7-1 | node1 | 192.168.142.66 |
| centos7-2 | node2 | 192.168.142.77 |
| centos7-3 | node3 | 192.168.142.132 |
| centos7-4 | node4 | 192.168.142.136 |
| centos7-min | client | 192.168.142.172 |
二、开始安装
(1)为满足实验目的增添硬盘
centos7-1
/dev/sdb1 20G 33M 20G 1% /mnt/sdb1/dev/sdc1 20G 33M 20G 1% /mnt/sdc1/dev/sdd1 20G 33M 20G 1% /mnt/sdd1/dev/sde1 20G 33M 20G 1% /mnt/sde1centos7-2
/dev/sdb1 20G 33M 20G 1% /mnt/sdb1/dev/sdc1 20G 33M 20G 1% /mnt/sdc1/dev/sdd1 20G 33M 20G 1% /mnt/sdd1/dev/sde1 20G 33M 20G 1% /mnt/sde1centos7-3
/dev/sdb1 20G 33M 20G 1% /mnt/sdb1/dev/sdc1 20G 33M 20G 1% /mnt/sdc1/dev/sdd1 20G 33M 20G 1% /mnt/sdd1/dev/sde1 20G 33M 20G 1% /mnt/sde1centos7-4
/dev/sdb1 20G 33M 20G 1% /mnt/sdb1/dev/sdc1 20G 33M 20G 1% /mnt/sdc1/dev/sdd1 20G 33M 20G 1% /mnt/sdd1/dev/sde1 20G 33M 20G 1% /mnt/sde1(2)安装GFS(所有存储节点均需要安装)
修改本地hosts文件,方便识别
[root@node1 yum.repos.d]# vim /etc/hosts192.168.142.66 node1192.168.142.77 node2192.168.142.132 node3192.168.142.136 node4配置本地YUM源
(原自带YUM仓库无法满足需求)
[root@node1 mnt]# cd /etc/yum.repos.d/[root@node1 yum.repos.d]# mkdir bak[root@node1 yum.repos.d]# mv CentOS-* bak/[root@node3 zhy]# cp -r gfsrepo/ /mnt/[root@node3 yum.repos.d]# vim GFSrep.repo//手动添加[GFSrep]name=GFSbaseurl=file:///mnt/gfsrepogpgcheck=0enabled=1安装gfs组件并开启
[root@node1 yum.repos.d]# yum -y install glusterfs glusterfs-server glusterfs-fuse glusterfs-rdma//开启服务[root@node1 yum.repos.d]# systemctl start glusterd[root@node1 yum.repos.d]# systemctl enable glusterd[root@node1 yum.repos.d]# systemctl stop firewalld.service[root@node1 yum.repos.d]# setenforce 0与阿里时间服务器进行同步
[root@node1 yum.repos.d]# ntpdate ntp1.aliyun.com18 Dec 19:55:56 ntpdate[2843]: adjust time server 120.25.115.20 offset 0.010820 sec添加储存信任池(只需要在任一存储节点添加即可)
[root@node1 yum.repos.d]# gluster peer probe node2peer probe: success.[root@node1 yum.repos.d]# gluster peer probe node3peer probe: success.[root@node1 yum.repos.d]# gluster peer probe node4peer probe: success.[root@node1 yum.repos.d]# gluster peer status //查看各节点状态二、建立分布式卷
特点: (通过HASH算法进行分布)
没有冗余性
单点故障,数据会丢失
[root@node1 yum.repos.d]# gluster volume create fenbu node1:/mnt/sdb1 node2:/mnt/sdb1 force//使用node1的sdb1和node2的sdb1作为节点,部署分布式卷,"force"强制执行volume create: fenbu: success: please start the volume to access data //查看分布式卷信息[root@node1 yum.repos.d]# gluster volume info fenbuVolume Name: fenbuType: DistributeVolume ID: e7833052-a4c7-4c9f-9660-dc60db737543。。。。。。Bricks:Brick1: node1:/mnt/sdb1Brick2: node2:/mnt/sdb1//查看卷组列表[root@node1 yum.repos.d]# gluster volume list//开启分布式卷[root@node1 yum.repos.d]# gluster volume start fenbuvolume start: fenbu: success三、建立条带卷
特点:
根据偏移量将文件分成N块(N个条器节点),轮询的存储在每个Brick Server节点
存储大文件时,性能尤为突出
不具备冗余性,类似Raid0
[root@node1 mnt]# gluster volume create tiaodai stripe 2 node1:/mnt/sdc1 node2:/mnt/sdc1 force//"stripe" 分为两个区//开启条带卷[root@node1 mnt]# gluster volume start tiaodaivolume start: tiaodai: success//查看条带卷信息[root@node1 yum.repos.d]# gluster volume info fenbuVolume Name: tiaodai。。。。。。Status: Started。。。。。。Bricks:Brick1: node1:/mnt/sdc1Brick2: node2:/mnt/sdc1Options Reconfigured:四、建立复制卷
特点:
同一份文件保存一份或者多分副本
读写速度较慢
具备冗余性
必须由两个或更多数据库组成
[root@node1 mnt]# gluster volume create fuzhi replica 2 node3:/mnt/sdb1 node4:/mnt/sdb1 force//"replica" 建立副本数[root@node1 mnt]# gluster volume start fuzhivolume start: fuzhi: success[root@node1 mnt]# gluster volume info fuzhiVolume Name: fuzhi。。。。。。Status: Started。。。。。。Bricks:Brick1: node3:/mnt/sdb1Brick2: node4:/mnt/sdb1五、建立分布式条带卷
特点:
兼顾分布式卷和条带卷的功能
用于大文件处理
至少需要四台服务器
[root@node1 mnt]# gluster volume create fenbu-tiao stripe 2 node1:/mnt/sdd1 node2:/mnt/sdd1 node3:/mnt/sdd1 node4:/mnt/sdd1 force//"stripe" 具备条带卷功能,因此需要分片[root@node1 mnt]# gluster volume start fenbu-tiaovolume start: fenbu-tiao: success[root@node1 mnt]# gluster volume info fenbu-tiaoVolume Name: fenbu-tiao。。。。。。Status: Started。。。。。。Bricks:Brick1: node1:/mnt/sdd1Brick2: node2:/mnt/sdd1Brick3: node3:/mnt/sdd1Brick4: node4:/mnt/sdd1六、建立分布式复制卷
特点:
兼顾分布式和复制卷的功能
具有冗余功能
[root@node1 mnt]# gluster volume create fenbu-copy replica 2 node1:/mnt/sde1 node2:/mnt/sde1 node3:/mnt/sde1 node4:/mnt/sde1 force[root@node1 mnt]# gluster volume start fenbu-copyvolume start: fenbu-copy: success[root@node1 mnt]# gluster volume info fenbu-copyVolume Name: fenbu-copy。。。。。。Status: Started。。。。。。Bricks:Brick1: node1:/mnt/sde1Brick2: node2:/mnt/sde1Brick3: node3:/mnt/sde1Brick4: node4:/mnt/sde1七、客户端配置
修改本地Hosts文件
[root@node1 yum.repos.d]# vim /etc/hosts192.168.142.66 node1192.168.142.77 node2192.168.142.132 node3192.168.142.136 node4配置本地YUM源
[root@node1 mnt]# cd /etc/yum.repos.d/[root@node1 yum.repos.d]# mkdir bak[root@node1 yum.repos.d]# mv CentOS-* bak/[root@node3 zhy]# cp -r gfsrepo/ /mnt/[root@node3 yum.repos.d]# vim GFSrep.repo//手动添加[GFSrep]name=GFSbaseurl=file:///mnt/gfsrepogpgcheck=0enabled=1安装gfs组件
[root@node1 yum.repos.d]# yum -y install glusterfs glusterfs-fuseGFS新建的卷进行挂载
[root@client yum.repos.d]# mkdir -p /data/fenbu //新建分布式卷挂载点[root@client yum.repos.d]# mkdir -p /data/tiaodai //新建条带卷挂载点[root@client yum.repos.d]# mkdir -p /data/fuzhi //新建复制卷挂载点[root@client yum.repos.d]# mkdir -p /data/fenbu-tiao //新建分布式条带卷挂载点[root@client yum.repos.d]# mkdir -p /data/fenbu-copy //新建分布式复制卷[root@client yum.repos.d]# mount.glusterfs node1:fenbu /data/fenbu/ //将分布卷进行挂载[root@client yum.repos.d]# df -hT文件系统 类型 容量 已用 可用 已用% 挂载点node1:fenbu fuse.glusterfs 40G 65M 40G 1% /data/fenbu[root@client yum.repos.d]# mount.glusterfs node1:tiaodai /data/tiaodai/ //挂载条带卷[root@client yum.repos.d]# df -hT文件系统 类型 容量 已用 可用 已用% 挂载点node1:tiaodai fuse.glusterfs 40G 65M 40G 1% /data/tiaodai[root@client yum.repos.d]# mount.glusterfs node3:fuzhi /data/fuzhi //挂载复制卷[root@client yum.repos.d]# df -hT文件系统 类型 容量 已用 可用 已用% 挂载点node3:fuzhi fuse.glusterfs 20G 33M 20G 1% /data/fuzhi[root@client yum.repos.d]# mount.glusterfs node1:fenbu-tiao /data/fenbu-tiao/ //挂载分布式条带卷[root@client yum.repos.d]# df -hT文件系统 类型 容量 已用 可用 已用% 挂载点node1:fenbu-tiao fuse.glusterfs 80G 130M 80G 1% /data/fenbu-tiao[root@client yum.repos.d]# mount.glusterfs node4:fenbu-copy /data/fenbu-copy/ //挂载分布式复制卷[root@client yum.repos.d]# df -hT文件系统 类型 容量 已用 可用 已用% 挂载点node4:fenbu-copy fuse.glusterfs 40G 65M 40G 1% /data/fenbu-copy八、对各类卷进行测试
建立六个测试文件
[root@client data]# dd if=/dev/zero of=test1.log bs=10M count=10[root@client data]# dd if=/dev/zero of=test2.log bs=10M count=10[root@client data]# dd if=/dev/zero of=test3.log bs=10M count=10[root@client data]# dd if=/dev/zero of=test4.log bs=10M count=10[root@client data]# dd if=/dev/zero of=test5.log bs=10M count=10[root@client data]# dd if=/dev/zero of=test6.log bs=10M count=10将文件复制进各个卷中
[root@client data]# cp test* fenbu[root@client data]# cp test* fenbu-copy/[root@client data]# cp test* fenbu-tiao/[root@client data]# cp test* fuzhi/[root@client data]# cp test* tiaodai/查看分布式卷(node1:sdb1、node2:sdb1)
//node1[root@node1 mnt]# ll -h sdb1/总用量 400M-rw-r--r--. 2 root root 100M 12月 18 23:55 test1.log-rw-r--r--. 2 root root 100M 12月 18 23:56 test2.log-rw-r--r--. 2 root root 100M 12月 18 23:56 test4.log-rw-r--r--. 2 root root 100M 12月 18 23:56 test6.log//node2[root@node2 mnt]# ll -h sdb1/总用量 200M-rw-r--r--. 2 root root 100M 12月 18 23:56 test3.log-rw-r--r--. 2 root root 100M 12月 18 23:56 test5.log查看条带卷(node1:sdc1、node2:sdc1)
//将每个数据都分成两块存储(分成几份由建立时的stripe决定)//node1[root@node1 mnt]# ll -h sdc1/总用量 300M-rw-r--r--. 2 root root 50M 12月 18 23:57 test1.log-rw-r--r--. 2 root root 50M 12月 18 23:57 test2.log-rw-r--r--. 2 root root 50M 12月 18 23:57 test3.log-rw-r--r--. 2 root root 50M 12月 18 23:57 test4.log-rw-r--r--. 2 root root 50M 12月 18 23:57 test5.log-rw-r--r--. 2 root root 50M 12月 18 23:57 test6.log//node2[root@node2 mnt]# ll -h sdc1/总用量 300M-rw-r--r--. 2 root root 50M 12月 18 23:57 test1.log-rw-r--r--. 2 root root 50M 12月 18 23:57 test2.log-rw-r--r--. 2 root root 50M 12月 18 23:57 test3.log-rw-r--r--. 2 root root 50M 12月 18 23:57 test4.log-rw-r--r--. 2 root root 50M 12月 18 23:57 test5.log-rw-r--r--. 2 root root 50M 12月 18 23:57 test6.log查看复制卷(node3:sdb1、node4:sdb1)
//所有数据均复制一份存储//node3[root@node3 mnt]# ll -h sdb1/总用量 600M-rw-r--r--. 2 root root 100M 12月 18 23:57 test1.log-rw-r--r--. 2 root root 100M 12月 18 23:57 test2.log-rw-r--r--. 2 root root 100M 12月 18 23:57 test3.log-rw-r--r--. 2 root root 100M 12月 18 23:57 test4.log-rw-r--r--. 2 root root 100M 12月 18 23:57 test5.log-rw-r--r--. 2 root root 100M 12月 18 23:57 test6.log//node4[root@node4 mnt]# ll -h sdb1/总用量 600M-rw-r--r--. 2 root root 100M 12月 18 23:57 test1.log-rw-r--r--. 2 root root 100M 12月 18 23:57 test2.log-rw-r--r--. 2 root root 100M 12月 18 23:57 test3.log-rw-r--r--. 2 root root 100M 12月 18 23:57 test4.log-rw-r--r--. 2 root root 100M 12月 18 23:57 test5.log-rw-r--r--. 2 root root 100M 12月 18 23:57 test6.log查看分布式条带卷(node1:sdd1、node2:sdd1、node3:sdd1、node4:sdd1)
//node1 & node2[root@node1 mnt]# ll -h sdd1/总用量 200M-rw-r--r--. 2 root root 50M 12月 18 23:57 test1.log-rw-r--r--. 2 root root 50M 12月 18 23:57 test2.log-rw-r--r--. 2 root root 50M 12月 18 23:57 test4.log-rw-r--r--. 2 root root 50M 12月 18 23:57 test6.log[root@node2 mnt]# ll -h sdd1/总用量 200M-rw-r--r--. 2 root root 50M 12月 18 23:57 test1.log-rw-r--r--. 2 root root 50M 12月 18 23:57 test2.log-rw-r--r--. 2 root root 50M 12月 18 23:57 test4.log-rw-r--r--. 2 root root 50M 12月 18 23:57 test6.log//node3 & node4[root@node3 mnt]# ll -h sdd1/总用量 100M-rw-r--r--. 2 root root 50M 12月 18 23:57 test3.log-rw-r--r--. 2 root root 50M 12月 18 23:57 test5.log[root@node4 mnt]# ll -h sdd1/总用量 100M-rw-r--r--. 2 root root 50M 12月 18 23:57 test3.log-rw-r--r--. 2 root root 50M 12月 18 23:57 test5.log查看分布式复制卷(node1~4:sde1)
//node1 & node2[root@node1 mnt]# ll -h sde1/总用量 400M-rw-r--r--. 2 root root 100M 12月 18 23:56 test1.log-rw-r--r--. 2 root root 100M 12月 18 23:56 test2.log-rw-r--r--. 2 root root 100M 12月 18 23:56 test4.log-rw-r--r--. 2 root root 100M 12月 18 23:56 test6.log[root@node2 mnt]# ll -h sde1/总用量 400M-rw-r--r--. 2 root root 100M 12月 18 23:56 test1.log-rw-r--r--. 2 root root 100M 12月 18 23:56 test2.log-rw-r--r--. 2 root root 100M 12月 18 23:56 test4.log-rw-r--r--. 2 root root 100M 12月 18 23:56 test6.log//node3 & node4[root@node3 mnt]# ll -h sde1/总用量 200M-rw-r--r--. 2 root root 100M 12月 18 23:56 test3.log-rw-r--r--. 2 root root 100M 12月 18 23:56 test5.log[root@node4 mnt]# ll -h sde1/总用量 200M-rw-r--r--. 2 root root 100M 12月 18 23:56 test3.log-rw-r--r--. 2 root root 100M 12月 18 23:56 test5.log
分布式
文件
用量
条带
系统
节点
存储
功能
容量
数据
特点
类型
配置
冗余
服务
两个
信息
副本
性能
手动
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
科技互联网项目
互联网科技社
合肥互联网科技公司
中国 科技 互联网
互联网科技公司怎么样
未来的互联网科技
互联网科技缩写
亿账通互联网科技
万达互联网科技
互联网科技素材视频竖屏
哈尔滨新华互联网科技
互联网公司会议桌创意科技软装饰
互联网企业和科技型企业
千方科技属于互联网企业吗
洛阳昕诺飞互联网科技有限公司
互联网金融科技展
高科技互联网套路
吉林省码上互联网科技电话
互联网公司属于科技吗
同城互联网络科技
小马过河互联网科技
天津摩尔互联网科技
奇士达互联网科技
互联网科技公司介绍
团飞科技与伯堂互联网服务平台
汽车互联网创新科技园
迪庆互联网科技招生
四川慕妮娅互联网科技有限公司
江苏互联网智能科技产品出厂价
互联网时代高科技布局