发现一个很好linux的lib包下载地址:

https://centos.pkgs.org/8/centos-baseos-x86_64/userspace-rcu-0.10.1-2.el8.x86_64.rpm.html

我准备4台机器,

172.20.72.11  gluster server  
172.20.72.22 gluster server  
172.20.72.33 gluster client  
172.20.72.44 gluster client  

11,22 上部署了gluster server,33,44 部署client。 文件在22,33,44 上创建后,4台机器会同步增加或减少。

注意11 上新增的文件,其他文件是不会同步的。可能是副本的原因。

1. 4台机器 设置 主机名

https://blog.csdn.net/zhuchunyan_aijia/article/details/80480961

2. 配置/etc/hosts

172.20.72.11    zcy-nj-11
172.20.72.22    zcy-nj-22
172.20.72.33    zcy-nj-33
172.20.72.44    zcy-nj-44

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4 zcy-nj-11
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6 zcy-nj-11

3. 4台机器 设置 时间同步 
https://blog.csdn.net/zhuchunyan_aijia/article/details/80679590

4. 下载rpm :我用rpm 安装

http://mirror.centos.org/centos/7/storage/x86_64/gluster-5/

下载:

5. gluster-server 安装,11和22 两台机器上执行 。 发现依赖一些lib 包,我就从 下载

https://centos.pkgs.org/8/centos-baseos-x86_64/userspace-rcu-0.10.1-2.el8.x86_64.rpm.html

gluster-server主机的安装顺序:

rpm -ivh glusterfs-libs-5.10-1.el7.x86_64.rpm
rpm -ivh  glusterfs-5.10-1.el7.x86_64.rpm    
rpm -ivh  glusterfs-client-xlators-5.10-1.el7.x86_64.rpm 
rpm -ivh glusterfs-api-5.10-1.el7.x86_64.rpm 
rpm -ivh glusterfs-cli-5.10-1.el7.x86_64.rpm
rpm -ivh userspace-rcu-0.10.1-2.el8.x86_64.rpm

rpm -ivh glusterfs-fuse-5.10-1.el7.x86_64.rpm

---在上面链接中下载

rpm -ivh psmisc-22.20-16.el7.x86_64.rpm 
 rpm -ivh attr-2.4.46-13.el7.x86_64.rpm

rpm -ivh glusterfs-server-5.10-1.el7.x86_64

或者:

yum install -y centos-release-gluster glusterfs-server glusterfs-fuse glusterfs-rdma glusterfs       # 最好执行2次

安装过程报错1:

warning:attr-2.4.46-13.el7.x86_64.: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
error: Failed dependencies:
        libattr = 2.4.46-13.el7 is needed by attr-2.4.44-7.el6.i686

解决:

rpm -qa |grep libattr

版本与2.4.46-13 不一致,就yum update libattr 即可

如果发现libattr 没有,就从上面链接下载安装即可

 安装过程报错2:

attr psmisc 依赖

解决:

在上面的链接中下载 rpm 安装即可

一般可以先试试yum 里面 是否有,没有就只能下载rpm 了。

安装过程报错3:

error: Failed dependencies:
        liburcu-bp.so.6()(64bit) is needed by glusterfs-server-5.10-1.el7.x86_64
        liburcu-cds.so.6()(64bit) is needed by glusterfs-server-5.10-1.el7.x86_64

解决:rpm -ivh userspace-rcu-0.10.1-2.el8.x86_64.rpm

7. gluster server 启动 11和22 两台机器上执行

启动  开机启动
systemctl  start   glusterd.service
systemctl  enable  glusterd.service
systemctl  status  glusterd.service

可以ps -ef |grep gluster

关闭:

service glusterd stop 或者   systemctl  stop   glusterd.service

其实关闭的只是glusterd, 底层的文件同步还是正常的,通过 ps -ef |grep gluster kill掉,才会全部停掉

8. 节点信任池(集群添加peer,是服务端, 可以添加多个)

建立GlusterFS节点信任池,一旦信任池建立后,只有在信任池中的节点才能添加新服务器信任池中,这一步是为了下一步做准备

在11 和 22主机 任选一台主机执行,我选择11 主机:

zcy-nj-11 >   gluster peer probe  zcy-nj-22

查看状态:

> gluster peer status

两台机器执行 都是connected。如果不是,说明有防火墙,可以iptables -F 清空防火墙后,再看看。

9. 创建复制数据卷

https://www.cnblogs.com/bfmq/p/9990467.html

在11和22中选一台机器执行就可以

提前在11主机上新建文件夹 /local/storage_volumes  ,22主机上建: /local/storage_volumes

gluster volume create storage_volumes replica 2 zcy-nj-11:/local/storage_volumes zcy-nj-22:/local/storage_volumes

replica:  复制份数.  2表示复制2份, 后面跟的Brick的个数是复制的倍数,  2个或者4个的Brick

gluster volume create storage_volumes replica 3 zcy-nj-11:/local/storage_volumes zcy-nj-22:/local/storage_volumes  zcy-nj-22:/local/storage_volumes_3

replica  就改成3.

如下复制2分, 4个brick:

gluster volume create storage_volumes replica 2 zcy-nj-11:/local/storage_volumes zcy-nj-11:/local/storage_volumes_2  zcy-nj-22:/local/storage_volumes  zcy-nj-22:/local/storage_volumes_3

打开GlusterFs磁盘限额,此处限制大小是10G,也可以不用设置. (以下我没有用)

开启配额  : gluster volume quota storage_volumes enable
限制大小是10G : gluster volume quota storage_volumes limit-usage / 10GB

如果已经达到配额后,继续写入文件,会报错

failed to open ‘./test’: Disk quota exceeded

查询当前卷的配额列表:gluster volume quota storage_volumes list

删除当前目录的配额:gluster volume quota storage_volumes remove /test-dir

数据平衡

开始平衡:gluster volume rebalance storage_volumes start

平衡状态:gluster volume rebalance storage_volumes status

停止平衡:gluster volume rebalance storage_volumes stop

文件修复

启动文件修复:gluster volume heal storage_volumes full

文件修复状态:gluster volume heal storage_volumes info

遇到报错1:volume create failed: Host is not in 'Peer in Cluster' state

解决:

主机间有防火墙

可以看一下  gluster peer status 
  显示 disconner
  telnet ip 24007 发现网络不通
  可以iptables -F 
  在看看 gluster peer status  显示 connect

10. 启动数据卷

在11和22中选一台机器执行就可以

gluster volume start storage_volumes

查看状态: gluster volume info

停止卷: 
#gluster volume stop storage_volumes

删除卷: #gluster volume delete storage_volumes //先停止卷后才能

11 . gluster 客户端安装,在33 和 44 主机执行

Glusterfs client端有三种客户端使用方式:Native mount,NFS,Samba

-此处使用Native mount挂载gluster volume 到zcy-nj-11和zcy-nj-22节点的本地目录/local/mntt下

与server 安装很像,就是不需要安装gluster-server了

rpm -ivh glusterfs-libs-5.10-1.el7.x86_64.rpm
rpm -ivh  glusterfs-5.10-1.el7.x86_64.rpm 
rpm -ivh  glusterfs-client-xlators-5.10-1.el7.x86_64.rpm 
 rpm  -ivh glusterfs-fuse-5.10-1.el7.x86_64.rpm

或者   客户端安装:yum install glusterfs glusterfs-fuse attr -y

12. 在gluster 客户端 挂在卷 :在33 和 44 主机执行

mount -t glusterfs zcy-nj-11:/storage_volumes  /local/mntt

/local/mntt : 是44主机放文件的目录

storage_volumes:卷的名称

挂载:

umount -v glusterfs zcy-nj-11:/storage_volumes

设置开机自动挂载

vim /etc/fstab
zcy-nj-11:/storage_volumes  /local/mntt glusterfs  defaults 0 0

遇到的报错:mount: unknown filesystem type 'glusterfs'

安装fuse 既可以: rpm  -ivh glusterfs-fuse-5.10-1.el7.x86_64.rpm

13 测试

在22,33,44 的文件下 可以互相同步拉

场景:   11主机坏了, 22主机正常, 33是client 挂载的是11主机. 

             现新增加一台55主机. 将11 迁移到55

操作:

1>  将55主机 安装gluster 服务, 参考5. gluster-server 安装

在22,33主机中的hosts中增加  172.20.72.55      zcy-nj-55

在55主机增加

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4 zcy-nj-55
                    ::1         localhost localhost.localdomain localhost6 localhost6.localdomain6 zcy-nj-55

172.20.72.22      zcy-nj-22

2> 55主机加入集群

在22主机上执行: gluster peer probe  zcy-nj-55

查看peer状态:  gluster peer status

或者: gluster pool list

显示新增了peer

3> 添加Brick (扩展卷)

在55主机新建目录 :   mkdir -p    /local/storage_volumes

 在22或者55主机执行:  gluster volume add-brick   storage_volumes   replica 3  zcy-nj-55:/local/storage_volumes

storage_volumes: 卷的名称,

a> 列出卷列表:  gluster volume list

b> 列出卷信息:  gluster volume info   storage_volumes

c> 卷的状态: gluster volume status

replica 3 :

创建storage_volumes时是2, 因为要在卷中新增brick, 所以改成3 否则报错地

执行后gluster volume info   storage_volumes 显示有3个brick 了

4> 删除brick(收缩卷)

在主机22或者55上执行: gluster volume remove-brick  storage_volumes  replica 2  zcy-nj-11:/local/storage_volumes1  force

注意: replica  必须是2, 因为要收缩

5>集群中移除节点11,需要提前将该节点上的brick移除

需要提前将该节点上的brick移除(如4>操作),  这时候在22或者55主机上可以执行 gluster peer detach zcy-nj-11 .

6> 33 客户断把11的挂载替换成55或者22

umount -v glusterfs zcy-nj-11:/storage_volumes

mount -t glusterfs zcy-nj-22:/storage_volumes  /local/mntt

7> 验证22,55,33 文件正常

glusterfs 文件服务器 搭建相关推荐

  1. 文件服务器搭建 xp,xp文件服务器搭建

    xp文件服务器搭建 内容精选 换一换 登录Windows操作系统的弹性云服务器时,需使用密码方式登录.因此,用户需先根据创建弹性云服务器时使用的密钥文件,获取该弹性云服务器初始安装时系统生成的管理员密 ...

  2. 文件服务器 说明,文件服务器搭建说明.pdf

    文件共享服务器搭建 责任人 姜 源 起讫时间 2010 11 15 至 2010 12 19 编号 JY001 0 目录目录 一 确定实现方案 1 二 方案实现方法 4 三 参考资料 12 1 文件服 ...

  3. Nginx 静态文件服务器搭建及autoindex模块解析

    ngx_http_autoindex_module ngx_http_autoindex_module模块处理以斜杠字符('/')结尾的请求,并生成目录列表. 当ngx_http_index_modu ...

  4. 企业文件服务器搭建案例

    6.9 章节案例 在本章案例讲解中通过4个模拟项目对Samba的功能进行演示,其中第一个案例模拟一个企业中服务器全部基于RHEL5.x,客户端在访问Samba服务器时,用户认证及所有用户行为控制全部通 ...

  5. windows文件服务器 文件方案,windowsserver2008文件服务器搭建2种方案.docx

    文件服务器搭建的两种方案范光华制作 文件服务器搭建的两种方案范光华制作 文件服务器搭建的两种方案 搭建目的: 1.实现企业文件共享与传输,提高工作效率: 2.提高企业访问文件的安全性. 搭建环境: 1 ...

  6. 企业架设文件服务器,企业文件服务器搭建案例

    <Linux服务器配置全程实录>第6章使用Samba配置文件服务器.Samba作为类UNIX系统和Windows的通信的桥梁,目前应用非常广泛,本章中在RHEL下通过Samba配置文件服务 ...

  7. 阿里云服务器ECS 第一篇:FTP文件服务器搭建

    < 第一篇:FTP文件服务器搭建 > 目前打算将项目部署到阿里云服务器上,并配置系统运行环境,搭建FTP服务器是系统部署的第一步,为了后期文件传输方便快捷,所以从这里开始!!! 关于FTP ...

  8. 邮件服务器 文件服务器,搭建邮件、终端和文件服务器应用方案_服务器_服务器x86服务器-中关村在线...

    邮件服务器方案 通常来说,初创企业邮件服务器对处理器性能要求并不高,但是由于要支持一定数量的并发连接,对于网络子系统和内存有一定的要求.邮件服务器软件对于内存需求也较高,同时需要较大的存储空间用来邮件 ...

  9. 【tool】企业级开源分布式文件服务器搭建(FastDFS)

    项目介绍 FastDFS介绍 FastDFS是一个以C语言开发的开源轻量级分布式文件系统,由阿里巴巴开发并开源.它对文件进行管理,功能包括:文件存储.文件同步.文件访问(上传.下载)等.解决了大容量存 ...

最新文章

  1. Java集合---LinkedList源码解析
  2. python的编程模式-Python设计模式之状态模式原理与用法详解
  3. struts2+spring3.2简单demo
  4. VTK:选择可见点用法实战
  5. Linux时间子系统之二:表示时间的单位和结构【转】
  6. Python中利用LSTM模型进行时间序列预测分析
  7. 3项目里面全局用less变量 cli vue_Vue实战14——抽离全局less变量与Vuex持久化、多模块构建...
  8. c语言中区别一般变量,C语言中,为了区别一般的变量,符号常量必须用
  9. 开发环境搭建3:linux下tuxedo安装
  10. 中间件技术是一种计算机游戏,游戏界面中间件有哪些
  11. 热血传奇客户端wil文件中文含义详解
  12. istio搭建testbed 补充(指令汇集)
  13. JavaScript分解质因数
  14. 6-1 插入法建立有序链表
  15. 首金奥运健儿杨倩,获得金牌和奖金缴纳个税吗?雅戈尔赠送她一套房,交税吗?
  16. Linux 的父进程和子进程的执行情况(附有案例代码)
  17. 判断某整数是否既是5又是7的整数倍
  18. Python爬取数据存储到本地文本文件
  19. 神经网络 深度神经网络,边缘计算 神经网络
  20. 毕业设计 RFID智能门禁系统 - 单片机 物联网 嵌入式

热门文章

  1. 全部资源,都在这里了
  2. 【学习笔记】山东大学生物信息学-05 高通量测序技术介绍 + 06 统计基础与序列算法(原理)
  3. 煤矿用计算机,计算机技术在煤矿安全生产中应用
  4. 一个python爬虫工程师参加博主之星之后,必做的事情
  5. 网站被UC浏览器转码怎么办,夸克浏览器转码怎么办,百度浏览器转码怎么办,解决所有浏览器转码。
  6. 第2章 计算机图形系统概述
  7. yolo-v3代码学习
  8. ThinkPHP5 集成使用 Layui 穿梭框(transfer)控件
  9. 带空格直角三角形图案
  10. 码农被3年资深程序员狂喷:根本不懂代码!