GFS基础配置安装(纯实战)
发表于:2025-12-02 作者:千家信息网编辑
千家信息网最后更新 2025年12月02日,GFS基础配置安装基本概述 GFS是一个可扩展的分布式文件系统,用于大型的、分布式的、对大量数据进行访问的应用。它运行于廉价的普通硬件上,并提供容错功能。它可以给大量的用户提供总体性能较高的服务。基
千家信息网最后更新 2025年12月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安全错误
数据库的锁怎样保障安全
关于网络安全培训的简报
数据库按内容和文献类型分类
粤教版网络技术
软件开发项目实训总结
网络安全需要学信号吗
万方数据库与知网数据库
如何分离一个数据库
图形用户界面连接数据库
数据库查询页面
重庆红黑树软件开发公司
网络技术服务中心的顾客有哪些
百度百科是常用文件数据库吗
杭州智慧大脑网络安全
适合学校用软件开发
宝山区媒体数据库服务商活动简介
奇游 数据库
数据库约束冲突怎么解决
软件开发有什么副业
电商和软件开发营业执照注册范围
数据库er模型设计内容主题
网络技术应用pdf浙江版
戴尔服务器前景
上海软件开发 了解志先科技
学软件开发必须去培训班吗
迪庆专业回收服务器
苏州银行软件开发
服务器pioneer
2019网络安全热点事件
深圳三轴点胶软件开发
网络安全方向考研考什么