1.1 分布式文件系统

1.1.1 什么是分布式文件系统

  相对于本机端的文件系统而言,分布式文件系统(英语:Distributed file system, DFS),或是网络文件系统(英语:Network File System),是一种允许文件通过网络在多台主机上分享的文件系统,可让多机器上的多用户分享文件和存储空间。

  在这样的文件系统中,客户端并非直接访问底层的数据存储区块,而是通过网络,以特定的通信协议和服务器沟通。借由通信协议的设计,可以让客户端和服务器端都能根据访问控制清单或是授权,来限制对于文件系统的访问。

1.1.2 glusterfs是什么

  Gluster是一个分布式文件系统。它是各种不同的存储服务器之上的组合,这些服务器由以太网或无限带宽技术Infiniband以及远程直接内存访问RDMA互相融汇,最终所形成的一个大的并行文件系统网络。

  它有包括云计算在内的多重应用,诸如:生物医药科学,文档存储。Gluster是由GNU托管的自由软件,证书是AGPL。Gluster公司是Gluster的首要商业赞助商,且提供商业产品以及基于Gluster的解决方案。

1.2 快速部署GlusterFS

1.2.1 环境说明

注意:最少需要拥有两块硬盘

系统环境说明

glusterfs01信息

[root@glusterfs01 ~]# hostname
glusterfs01
[root@glusterfs01 ~]# uname -r
3.10.0-693.el7.x86_64
[root@glusterfs01 ~]# sestatus
SELinux status: disabled
[root@glusterfs01 ~]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)
[root@glusterfs01 ~]# hostname -I
10.0.0.120 172.16.1.120

glusterfs02信息

[root@glusterfs02 ~]# uname -r
3.10.0-693.el7.x86_64
[root@glusterfs02 ~]# sestatus
SELinux status: disabled
[root@glusterfs02 ~]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)
[root@glusterfs02 ~]# hostname -I
10.0.0.121 172.16.1.121

注意配置好hosts解析

1.2.2 前期准备

gluster01主机挂载磁盘

[root@glusterfs01 ~]# mkfs.xfs /dev/sdb
[root@glusterfs01 ~]# mkdir -p /data/brick1
[root@glusterfs01 ~]# echo '/dev/sdb /data/brick1 xfs defaults 0 0' >> /etc/fstab
[root@glusterfs01 ~]# mount -a && mount

gluster02主机挂载磁盘

[root@glusterfs02 ~]# mkfs.xfs /dev/sdb
[root@glusterfs02 ~]# mkdir -p /data/brick1
[root@glusterfs02 ~]# echo '/dev/sdb /data/brick1 xfs defaults 0 0' >> /etc/fstab
[root@glusterfs02 ~]# mount -a && mount

1.3 部署GlusterFS

1.3.1 安装软件

在两个节点上操作

yum install centos-release-gluster -y
# 修改镜像源加速
sed -i 's#http://mirror.centos.org#https://mirrors.shuosc.org#g' /etc/yum.repos.d/CentOS-Gluster-3.12.repo
yum install -y glusterfs glusterfs-server glusterfs-fuse glusterfs-rdma

软件版本

[root@glusterfs01 ~]#  rpm  -qa glusterfs
glusterfs-3.12.5-2.el7.x86_64

1.3.2 启动GlusterFS

在两个节点上都进行操作

[root@glusterfs01 ~]# systemctl start glusterd.service
[root@glusterfs01 ~]# systemctl status glusterd.service
● glusterd.service - GlusterFS, a clustered file-system server
Loaded: loaded (/usr/lib/systemd/system/glusterd.service; disabled; vendor preset: disabled)
Active: active (running) since 三 2018-02-07 21:02:44 CST; 2s ago
Process: 1923 ExecStart=/usr/sbin/glusterd -p /var/run/glusterd.pid --log-level $LOG_LEVEL $GLUSTERD_OPTIONS (code=exited, status=0/SUCCESS)
Main PID: 1924 (glusterd)
CGroup: /system.slice/glusterd.service
└─1924 /usr/sbin/glusterd -p /var/run/glusterd.pid --log-level INFO 2月 07 21:02:44 glusterfs01 systemd[1]: Starting GlusterFS, a clustered file-system server...
2月 07 21:02:44 glusterfs01 systemd[1]: Started GlusterFS, a clustered file-system server.
Hint: Some lines were ellipsized, use -l to show in full.

1.3.3 配置互信(可信池)

在glusterfs01上操作

[root@glusterfs01 ~]# gluster peer probe glusterfs02
peer probe: success.

在glusterfs02上操作

[root@glusterfs02 ~]# gluster peer probe glusterfs01
peer probe: success.

注意:一旦建立了这个池,只有受信任的成员可能会将新的服务器探测到池中。新服务器无法探测池,必须从池中探测。

1.3.4 检查对等状态

[root@glusterfs01 ~]#  gluster peer status
Number of Peers: 1 Hostname: 10.0.0.121
Uuid: 61d043b0-5582-4354-b475-2626c88bc576
State: Peer in Cluster (Connected)
Other names:
glusterfs02

注意:看到的UUID应不相同。

[root@glusterfs02 ~]#  gluster peer status
Number of Peers: 1 Hostname: glusterfs01
Uuid: e2a9367c-fe96-446d-a631-194970c18750
State: Peer in Cluster (Connected)

1.3.5 建立一个GlusterFS卷

在两个节点上操作

mkdir -p /data/brick1/gv0

在任意一个节点上执行

[root@glusterfs01 ~]# gluster volume create gv0 replica 2 glusterfs01:/data/brick1/gv0 glusterfs02:/data/brick1/gv0
Replica 2 volumes are prone to split-brain. Use Arbiter or Replica 3 to avoid this. See: http://docs.gluster.org/en/latest/Administrator%20Guide/Split%20brain%20and%20ways%20to%20deal%20with%20it/.
Do you still want to continue?
(y/n) y
volume create: gv0: success: please start the volume to access data

启用存储卷

[root@glusterfs01 ~]# gluster volume start gv0
volume start: gv0: success

查看信息

[root@glusterfs01 ~]# gluster volume info 

Volume Name: gv0
Type: Replicate
Volume ID: 865899b9-1e5a-416a-8374-63f7df93e4f5
Status: Started
Snapshot Count: 0
Number of Bricks: 1 x 2 = 2
Transport-type: tcp
Bricks:
Brick1: glusterfs01:/data/brick1/gv0
Brick2: glusterfs02:/data/brick1/gv0
Options Reconfigured:
transport.address-family: inet
nfs.disable: on
performance.client-io-threads: off

至此,服务端配置结束

1.4 客户端测试

1.4.1 安装客户端工具

挂载测试

[root@clsn6 ~]# yum install centos-release-gluster -y
[root@clsn6 ~]# yum install -y glusterfs glusterfs-fuse

注意:要配置好hosts文件,否则连接会出错

[root@clsn6 ~]# mount.glusterfs  glusterfs01:/gv0 /mnt
[root@clsn6 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 19G 2.2G 16G 13% /
tmpfs 238M 0 238M 0% /dev/shm
/dev/sda1 190M 40M 141M 22% /boot
glusterfs01:/gv0 100G 33M 100G 1% /mnt

1.4.2 复制文件测试

[root@clsn6 ~]# for i in `seq -w 1 100`; do cp -rp /var/log/messages /mnt/copy-test-$i; done

客户端检查文件

[root@clsn6 ~]#  ls -lA /mnt/copy* | wc -l
10

服务节点检查文件

[root@glusterfs01 ~]#   ls -lA /data/brick1/gv0/copy* |wc -l
100

服务节点检查文件

[root@glusterfs02 ~]#   ls -lA /data/brick1/gv0/copy* |wc -l
100

至此Glusterfs简单配置完成

1.5 参考文献

分布式文件系统---GlusterFS的更多相关文章

  1. 分布式文件系统GlusterFS

    转自于:http://www.cnblogs.com/zitjubiz/archive/2012/11/30/Distributed_File_System_glusterFS.html Gluste ...

  2. 分布式文件系统glusterfs安装步骤

    我的系统是 RHEL5 , 可能环境不一样, 需要安装的第三方依赖不一样啊, 反正大家在安装的过程中缺少什么就去安装什么, 一般都会有提示的. 下载   glusterfs-3.2.0.tar.gz  ...

  3. GlusterFS分布式文件系统的使用

    glusterfs是一款开源的分布式文件系统. 它具备高扩展.高可用及高性能等特性,由于其无元数据服务器的设计,使其真正实现了线性的扩展能力,使存储总容量可轻松达到PB级别,支持数千客户端并发访问. ...

  4. GlusterFS 分布式文件系统的使用入门-管理GlusterFS卷

    GlusterFS 分布式文件系统的使用入门-管理GlusterFS卷 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.卷的扩容 您可以根据需要在群集联机且可用时扩展卷.例如,您 ...

  5. GlusterFS分布式文件系统部署及基本使用(CentOS 7.6)

    GlusterFS分布式文件系统部署及基本使用(CentOS 7.6) 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. Gluster File System 是一款自由软件,主要由 ...

  6. GlusterFS分布式文件系统部署

    GlusterFS是一个可伸缩的网络文件系统,使用常见的现成的硬件,您可以创建大型分布式存储流媒体解决方案.数据分析.和其他数据相关的任务.GlusterFS是自由和开源软件. 详细参考官网:http ...

  7. GlusterFS分布式文件系统高速管理

    TaoCloud XDFS基于GlusterFS开源分布式文件系统,进行了系统优化.project化.定制化和产品化工作,五年以上的实践积累了大量实践经验,包含客户案例.最佳实践.定制开发.咨询服务和 ...

  8. GlusterFS 分布式文件系统

    简介 官方文档:https://docs.gluster.org/en/latest/Quick-Start-Guide/Architecture/ Glusterfs是一个开源的分布式文件系统,是S ...

  9. glusterfs分布式文件系统

    第一:安装依赖包: yum install libibverbs librdmacm xfsprogs nfs-utils rpcbind libaio liblvm2app  lvm2-devel ...

随机推荐

  1. 《必须知道.NET》3.OO之美

    3.2 依赖的哲学 3.2.1 本质诠释 "不要调用我们,我们会调用你" 3.2.2 什么是依赖,什么是抽象 "耦合是不可避免的" (1)什么是依赖和耦合 依赖 ...

  2. Shiro介绍

    前言 本文主要讲解的知识点有以下: 权限管理的基础知识 模型 粗粒度和细粒度的概念 回顾URL拦截的实现 Shiro的介绍与简单入门 一.Shiro基础知识 在学习Shiro这个框架之前,首先我们要先 ...

  3. mysql undo 和redo 被误删除的恢复操作(一致性)

    今天在群里看到有人说不熟悉innodb把ibdata(数据文件)和ib_logfile(事务日志)文件误删除了.不知道怎么解决.当时我也不知道怎么办.后来查阅相关资料.终找到解决方法.其实恢复也挺简单 ...

  4. vtiger7菜单管理

    添加了新模块,但是菜单上却没显示. 和菜单相关的表有4张 我们要把新建的message放到support模块下面 1.把默认的父级目录tools改成support 2. app2tab 0表示不显示, ...

  5. Codeforces Round #144 (Div. 2) D table

    CodeForces - 233D 题目大意给你一个n*m 的矩阵,要求你进行涂色,保证每个n*n的矩阵内都有k个点被涂色. 问你一共有多少种涂色方案. n<=100 && m& ...

  6. Python Mysql_db对数据查询进行处理

    引用自:https://www.cnblogs.com/itdyb/p/5700614.html 一.脚本如下 #!/usr/bin/python2.7# coding=utf-8import tim ...

  7. Linux使用netstat命令查看并发连接数

    我们的网站部署在linux的服务器上,特别是web服务器,我们可能有时候做为运维人员,肯定是要查看网站的并发连接数是不是达到瓶颈等,所以在linux下,我们如何查看服务器的并发连接数呢?使用以下命令即 ...

  8. Java相关英语单词

    day1 Java概述 掌握 .JDK abbr. Java开发工具包(Java Developer's Kit) (abbr.缩写) .JRE abbr. Java运行环境(Java Runtime ...

  9. 【Java】 剑指offer(45) 把数组排成最小的数

    本文参考自<剑指offer>一书,代码采用Java语言. 更多:<剑指Offer>Java实现合集   题目 输入一个正整数数组,把数组里所有数字拼接起来排成一个数,打印能拼接 ...

  10. 如何查看Unity的版本

    打开Unity,Help->About Unity