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/sde1

centos7-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/sde1

centos7-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/sde1

centos7-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文件,方便识别

[[email protected] yum.repos.d]# vim /etc/hosts
192.168.142.66 node1
192.168.142.77 node2
192.168.142.132 node3
192.168.142.136 node4

配置本地YUM源

(原自带YUM仓库无法满足需求)

[[email protected] mnt]# cd /etc/yum.repos.d/
[[email protected] yum.repos.d]# mkdir bak
[[email protected] yum.repos.d]# mv CentOS-* bak/
[[email protected] zhy]# cp -r gfsrepo/ /mnt/
[[email protected] yum.repos.d]# vim GFSrep.repo
//手动添加
[GFSrep]
name=GFS
baseurl=file:///mnt/gfsrepo
gpgcheck=0
enabled=1

安装gfs组件并开启

[[email protected] yum.repos.d]# yum -y install glusterfs glusterfs-server glusterfs-fuse glusterfs-rdma

//开启服务
[[email protected] yum.repos.d]# systemctl start glusterd
[[email protected] yum.repos.d]# systemctl enable glusterd
[[email protected] yum.repos.d]# systemctl stop firewalld.service
[[email protected] yum.repos.d]# setenforce 0

与阿里时间服务器进行同步

[[email protected] yum.repos.d]# ntpdate ntp1.aliyun.com
18 Dec 19:55:56 ntpdate[2843]: adjust time server 120.25.115.20 offset 0.010820 sec

添加储存信任池(只需要在任一存储节点添加即可)

[[email protected] yum.repos.d]# gluster peer probe node2
peer probe: success.
[[email protected] yum.repos.d]# gluster peer probe node3
peer probe: success.
[[email protected] yum.repos.d]# gluster peer probe node4
peer probe: success.
[[email protected] yum.repos.d]# gluster peer status          //查看各节点状态

二、建立分布式卷

特点: (通过HASH算法进行分布)

没有冗余性

单点故障,数据会丢失

[[email protected] 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

 //查看分布式卷信息
[[email protected] yum.repos.d]# gluster volume info fenbu

Volume Name: fenbu
Type: Distribute
Volume ID: e7833052-a4c7-4c9f-9660-dc60db737543
。。。。。。
Bricks:
Brick1: node1:/mnt/sdb1
Brick2: node2:/mnt/sdb1

//查看卷组列表
[[email protected] yum.repos.d]# gluster volume list

//开启分布式卷
[[email protected] yum.repos.d]# gluster volume start fenbu
volume start: fenbu: success

三、建立条带卷

特点:

根据偏移量将文件分成N块(N个条器节点),轮询的存储在每个Brick Server节点

存储大文件时,性能尤为突出

不具备冗余性,类似Raid0

[[email protected] mnt]# gluster volume create tiaodai stripe 2 node1:/mnt/sdc1 node2:/mnt/sdc1 force
//“stripe”  分为两个区

//开启条带卷
[[email protected] mnt]# gluster volume start tiaodai
volume start: tiaodai: success

//查看条带卷信息
[[email protected] yum.repos.d]# gluster volume info fenbu
Volume Name: tiaodai
。。。。。。
Status: Started
。。。。。。
Bricks:
Brick1: node1:/mnt/sdc1
Brick2: node2:/mnt/sdc1
Options Reconfigured:

四、建立复制卷

特点:

同一份文件保存一份或者多分副本

读写速度较慢

具备冗余性

必须由两个或更多数据库组成

[[email protected] mnt]# gluster volume create fuzhi replica 2 node3:/mnt/sdb1 node4:/mnt/sdb1 force
//“replica”    建立副本数

[[email protected] mnt]# gluster volume start fuzhi
volume start: fuzhi: success

[[email protected] mnt]# gluster volume info fuzhi

Volume Name: fuzhi
。。。。。。
Status: Started
。。。。。。
Bricks:
Brick1: node3:/mnt/sdb1
Brick2: node4:/mnt/sdb1

五、建立分布式条带卷

特点:

兼顾分布式卷和条带卷的功能

用于大文件处理

至少需要四台服务器

[[email protected] mnt]# gluster volume create fenbu-tiao stripe 2 node1:/mnt/sdd1 node2:/mnt/sdd1 node3:/mnt/sdd1 node4:/mnt/sdd1 force
//“stripe”   具备条带卷功能,因此需要分片

[[email protected] mnt]# gluster volume start fenbu-tiao
volume start: fenbu-tiao: success

[[email protected] mnt]# gluster volume info fenbu-tiao

Volume Name: fenbu-tiao
。。。。。。
Status: Started
。。。。。。
Bricks:
Brick1: node1:/mnt/sdd1
Brick2: node2:/mnt/sdd1
Brick3: node3:/mnt/sdd1
Brick4: node4:/mnt/sdd1

六、建立分布式复制卷

特点:

兼顾分布式和复制卷的功能

具有冗余功能

[[email protected] mnt]# gluster volume create fenbu-copy replica 2 node1:/mnt/sde1 node2:/mnt/sde1 node3:/mnt/sde1 node4:/mnt/sde1 force

[[email protected] mnt]# gluster volume start fenbu-copy
volume start: fenbu-copy: success

[[email protected] mnt]# gluster volume info fenbu-copy

Volume Name: fenbu-copy
。。。。。。
Status: Started
。。。。。。
Bricks:
Brick1: node1:/mnt/sde1
Brick2: node2:/mnt/sde1
Brick3: node3:/mnt/sde1
Brick4: node4:/mnt/sde1

七、客户端配置

修改本地Hosts文件

[[email protected] yum.repos.d]# vim /etc/hosts
192.168.142.66 node1
192.168.142.77 node2
192.168.142.132 node3
192.168.142.136 node4

配置本地YUM源

[[email protected] mnt]# cd /etc/yum.repos.d/
[[email protected] yum.repos.d]# mkdir bak
[[email protected] yum.repos.d]# mv CentOS-* bak/
[[email protected] zhy]# cp -r gfsrepo/ /mnt/
[[email protected] yum.repos.d]# vim GFSrep.repo
//手动添加
[GFSrep]
name=GFS
baseurl=file:///mnt/gfsrepo
gpgcheck=0
enabled=1

安装gfs组件

[[email protected] yum.repos.d]# yum -y install glusterfs glusterfs-fuse

GFS新建的卷进行挂载

[[email protected] yum.repos.d]# mkdir -p /data/fenbu              //新建分布式卷挂载点
[[email protected] yum.repos.d]# mkdir -p /data/tiaodai             //新建条带卷挂载点
[[email protected] yum.repos.d]# mkdir -p /data/fuzhi               //新建复制卷挂载点
[[email protected] yum.repos.d]# mkdir -p /data/fenbu-tiao       //新建分布式条带卷挂载点
[[email protected] yum.repos.d]# mkdir -p /data/fenbu-copy     //新建分布式复制卷

[[email protected] yum.repos.d]# mount.glusterfs node1:fenbu /data/fenbu/             //将分布卷进行挂载
[[email protected] yum.repos.d]# df -hT
文件系统                类型            容量  已用  可用 已用% 挂载点
node1:fenbu             fuse.glusterfs   40G   65M   40G    1% /data/fenbu

[[email protected] yum.repos.d]# mount.glusterfs node1:tiaodai /data/tiaodai/         //挂载条带卷
[[email protected] yum.repos.d]# df -hT
文件系统                类型            容量  已用  可用 已用% 挂载点
node1:tiaodai           fuse.glusterfs   40G   65M   40G    1% /data/tiaodai

[[email protected] yum.repos.d]# mount.glusterfs node3:fuzhi /data/fuzhi             //挂载复制卷
[[email protected] yum.repos.d]# df -hT
文件系统                类型            容量  已用  可用 已用% 挂载点
node3:fuzhi             fuse.glusterfs   20G   33M   20G    1% /data/fuzhi

[[email protected] yum.repos.d]# mount.glusterfs node1:fenbu-tiao /data/fenbu-tiao/         //挂载分布式条带卷
[[email protected] yum.repos.d]# df -hT
文件系统                类型            容量  已用  可用 已用% 挂载点
node1:fenbu-tiao        fuse.glusterfs   80G  130M   80G    1% /data/fenbu-tiao

[[email protected] yum.repos.d]# mount.glusterfs node4:fenbu-copy /data/fenbu-copy/       //挂载分布式复制卷
[[email protected] yum.repos.d]# df -hT
文件系统                类型            容量  已用  可用 已用% 挂载点
node4:fenbu-copy        fuse.glusterfs   40G   65M   40G    1% /data/fenbu-copy

八、对各类卷进行测试

建立六个测试文件

[[email protected] data]# dd if=/dev/zero of=test1.log bs=10M count=10

[[email protected] data]# dd if=/dev/zero of=test2.log bs=10M count=10

[[email protected] data]# dd if=/dev/zero of=test3.log bs=10M count=10

[[email protected] data]# dd if=/dev/zero of=test4.log bs=10M count=10

[[email protected] data]# dd if=/dev/zero of=test5.log bs=10M count=10

[[email protected] data]# dd if=/dev/zero of=test6.log bs=10M count=10

将文件复制进各个卷中

[[email protected] data]# cp test* fenbu
[[email protected] data]# cp test* fenbu-copy/
[[email protected] data]# cp test* fenbu-tiao/
[[email protected] data]# cp test* fuzhi/
[[email protected] data]# cp test* tiaodai/

查看分布式卷(node1:sdb1、node2:sdb1)

//node1
[[email protected] 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
[[email protected] 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
[[email protected] 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
[[email protected] 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
[[email protected] 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
[[email protected] 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
[[email protected] 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
[[email protected] 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
[[email protected] 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
[[email protected] 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
[[email protected] 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
[[email protected] 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
[[email protected] 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
[[email protected] 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

原文地址:https://blog.51cto.com/14484404/2460736

时间: 2024-08-29 12:10:47

GFS基础配置安装(纯实战)的相关文章

FasterDFS基础配置安装

FasterDFS基础配置安装 基本概述 ? FastDFS是一个开源的轻量级分布式文件系统,它对文件进行管理,功能包括:文件存储.文件同步.文件访问(文件上传.文件下载)等,解决了大容量存储和负载均衡的问题.特别适合以文件为载体的在线服务,如相册网站.视频网站等等. ? FastDFS为互联网量身定制,充分考虑了冗余备份.负载均衡.线性扩容等机制,并注重高可用.高性能等指标,使用FastDFS很容易搭建一套高性能的文件服务器集群提供文件上传.下载等服务. 基本结构图 FastDFS服务端有两个

Docker从入门到飞升:基础配置安装

导读 Docker近几年非常火,因为它是容器虚拟化,更能够充分提高硬件资源的使用率.其实利用率高不算什么,它最大的优势是能给让运维人员或者开发人员快速部署和交付资源,大大提高了工作效率.几乎所有的大企业都在使用docker,所以我们没有理由不去了解它,不去学习它. 一.初识Docker 容器虚拟化,比传统的虚拟化轻量. 2013年出现,发展非常迅猛. Redhat在6.5版本开始支持docker. 使用go语言开发,基于apache2.0协议. 开源软件,项目代码在github维护. docke

nginx基础配置加基础实战演示

目录 基本配置 设置用户 工作衍生进程数 错误日志存放路径 pid文件存放路径 设置最大连接数 http->server gzip 字符编码 nginx的基本格式 实战配置 虚拟主机配置 开始配置虚拟主机的ngix配置 查看日志是否有内容 基本配置 设置用户 设置用户,可以指明哪个用户可以使用nginx,nobody是低权限用户,提高用户的安全性.有"#"代表不需要设置用户. user nobody; 工作衍生进程数 工作衍生进程数, 1代表CPU的核数是1,也可以是核数的dou

CentOS7 下配置svn的安装及基础配置介绍

[[email protected] ~]# yum install subversion 查看是否安装安装成功[[email protected] ~]# svnserve --versionsvnserve, version 1.7.14 (r1542130) compiled Jun 9 2014, 18:54:44 Copyright (C) 2013 The Apache Software Foundation.This software consists of contributio

FastDFS安装使用实战二(配置篇)

FastDFS安装使用实战二(配置篇) Keywords:FastDFS.分布式文件系统.Ubuntu Author:soartju 转载请注明出处:http://soartju.iteye.com/blog/803524 FastDFS的配置文件在%FastDFS%/conf目录下,其中包括 Client.conf    客户端上传配置文件 Storage.conf    文件存储服务器配置文件 Tracker.conf    负责均衡调度服务器配置文件 http.conf        ht

Jenkins的下载与启动,插件安装,基础配置,

Jenkins网站下载Generic java package 启动Jenkins  命令:java -jar jenkins.war [root@localhost Jenkins]# java -jar jenkins.war Running from: /home/gzp_tool/Jenkins/jenkins.war webroot: $user.home/.jenkins Mar 16, 2019 2:40:19 AM org.eclipse.jetty.util.log.Log i

MongoDB基础安装(实战部署)

MongoDB基础安装 MongoDB概述 (1)MongoDB是一个基于分布式文件存储的数据库.由C++语言编写.旨在为WEB应用提供可扩展的高性能数据存储解决方案. (2)MongoDB是一个介于关系数据库和非关系数据库之间的产品,是非关系数据库当中功能最丰富,最像关系数据库的.它支持的数据结构非常松散,是类似json的bson格式,因此可以存储比较复杂的数据类型.Mongo最大的特点是它支持的查询语言非常强大,其语法有点类似于面向对象的查询语言,几乎可以实现类似关系数据库单表查询的绝大部分

mySQL安装与基础配置

关系型数据库介绍 数据结构模型 数据结构模型主要有: 层次模型 网状结构 关系模型 关系模型: 二维关系:row,column 数据库管理系统:DBMS 关系:Relational,RDBMS RDBMS专业名词 常见的关系型数据库管理系统: MySQL:MySQL,MariaDB,Percona-Server PostgreSQL:简称为pgsql Oracle MSSQL 事务:多个操作被当作一个整体对待就称为一个事务 要看一个关系型数据库是否支持事务,需要看其是否支持并满足ACID测试 A

YUM仓库在线简易安装单节点K8S(纯实战)

使用YUM仓库在线简易安装单节点K8S 实验环境: 使用系统:centos7.4 名称 角色 IP地址 centos7-min2 master 192.168.142.220 centos7-4 node 192.168.142.136 实验实施步骤: 一.配置步骤目录 master端配置 node端配置 实验结果检查 二.master端配置 使用yum仓库安装atcd数据库.kubernetes组件.flannel网络组件 [[email protected] ~]# yum install