zoukankan      html  css  js  c++  java
  • 分布式文件系统-glusterfs

    1.1 分布式文件系统

    1.1.1 什么是分布式文件系统

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

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

    1.1.2 glusterfs是什么

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

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

    1.1.3 安装环境

    CentOS Linux release 7.2.1511 (Core)  gs_1   10.0.0.101
    CentOS Linux release 7.2.1511 (Core)  gs_2   10.0.0.102
    

    1.1.4 安装glusterfs服务端

    [root@gs_1 ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
    # 指定安装的yum源
    [root@gs_1 ~]# yum install centos-release-gluster -y
    [root@gs_1 ~]# yum install glusterfs-server -y
    #配置信任池
    [root@gs_1 ~]# systemctl stop firewalld ######firewall-cmd --add-service=glusterfs --permanent && firewall-cmd --reload
    [root@gs_1 ~]# getenforce 
    Disabled
    [root@gs_1 ~]# systemctl restart glusterd
    [root@gs_1 ~]# gluster peer probe 10.0.0.101
    peer probe: success. Probe on localhost not needed
    [root@gs_1 ~]# gluster peer probe 10.0.0.102
    peer probe: success. 
    #查看
    [root@gs_1 ~]# gluster peer status
    Number of Peers: 1
    
    Hostname: 10.0.0.102
    Uuid: 41fb331e-4103-4b02-b88a-c0f3c7eecfc1
    State: Peer in Cluster (Connected)
    #创建目录
    [root@gs_1 ~]# mkdir -p /uusafe
    [root@gs_1 ~]# gluster volume create uusafe replica 2 10.0.0.101:/uusafe 10.0.0.102:/uusafe force  #10.0.0.101:卷名
    volume create: uusafe: success: please start the volume to access data
    #如果报错 在后面加上force,这是因为我们创建的uusafe在系统盘,这个在gluster的默认情况下是不允许的,生产环境下也尽可能的与系统盘分开,如果必须这样请使用force 
    #启动卷
    [root@gs_1 ~]# gluster volume start uusafe
    volume start: uusafe: success

    1.1.5 安装glusterfs客户端

    [root@db01 ~]# yum install -y glusterfs glusterfs-fuse
    #挂载/uusafe
    [root@db01 ~]# mkdir -p /uusafe
    [root@db01 ~]# mount -t glusterfs 10.0.0.101:/uusafe /uusafe
    #第二台机器
    [root@db02 ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
    [root@db02 ~]# yum install -y glusterfs glusterfs-fuse
    [root@db02 ~]# mkdir -p /uusafe
    [root@db02 ~]# mount -t glusterfs 10.0.0.101:uusafe /uusafe
    #开机自动挂载
    [root@db01 uusafe]# tail -1 /etc/fstab 
    10.0.0.101:/uusafe      /uusafe    glusterfs  defaults,_netdev        0 0
    #基本完成了文件同步

    1.1.6  glusterfs常用命令

    #添加磁盘
    gluster volume add-brick dht-vol1 10.20.0.200:/brick1/b1
    rebalance 同步数据
    gluster volume rebalance dht-vol1 start
    #删除磁盘
    gluster volume remove-brick dht-vol1 10.20.0.200:/brick1/b1 
    gluster volume rebalance dht-vol1 start
    #删除卷
    先停止 在删除 复制代码 # gluster volume stop dht-vol1 Stopping volume will make its data inaccessible. Do you want to continue? (y/n) y volume stop: dht-vol1: success # gluster volume delete dht-vol1 Deleting volume will erase all information about the volume. Do you want to continue? (y/n) y volume delete: dht-vol1: success # gluster volume info No volumes present #查看卷状态信息 gluster volume info #启动卷 gluster volume start dht-vol1 #停止卷 gluster volume stop dht-vol1

      

      

  • 相关阅读:
    Python 【第十三章】 Django 之 FORM
    Django-Model操作数据库(增删改查、连表结构)参考
    Python 【第十二章】 Django 之 Model 数据库操作
    Python 【第十一章】 Django模版
    Python 【第十章】 Django路由
    Ajax操作如何实现跨域请求 (JSONP和CORS实现Ajax跨域的原理)
    浏览器同源政策概述
    Python 【第九章】 Django基础
    python 2.7下的正则将中文分隔符去掉
    python time应用 之时间戳转换
  • 原文地址:https://www.cnblogs.com/so-cool/p/8608226.html
Copyright © 2011-2022 走看看