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

                                         作者:尹正杰

版权声明:原创作品,谢绝转载!否则将追究法律责任。

一.卷的扩容

  您可以根据需要在群集联机且可用时扩展卷。例如,您可能希望向分布式卷添加块,从而增加分发并增加GlusterFS卷的容量。

1>.添加扩展卷

[root@node101 ~]# df -h | grep gluster
node101.yinzhengjie.org.cn:/test-volume 23G 312M 22G % /mnt/gluster1
node101.yinzhengjie.org.cn:/replicated-volume 12G 156M 11G % /mnt/gluster2
node101.yinzhengjie.org.cn:/raid0-volume 23G 312M 22G % /mnt/gluster3
node101.yinzhengjie.org.cn:/distributed-replication-volume 12G 156M 11G % /mnt/gluster4
node101.yinzhengjie.org.cn:/my-distributed-replication-volume 12G 156M 11G % /mnt/gluster10
[root@node101 ~]#
[root@node101 ~]# mkdir /home/yinzhengjie/glusterfs/file8                                            #我们这里创建一个目录,用来模拟设备的挂载点
[root@node101 ~]#
[root@node101 ~]# gluster volume add-brick test-volume node101.yinzhengjie.org.cn:/home/yinzhengjie/glusterfs/file8         #我们将块存储挂载到分布式卷中
volume add-brick: success
[root@node101 ~]#
[root@node101 ~]#
[root@node101 ~]# gluster volume info test-volume Volume Name: test-volume
Type: Distribute
Volume ID: d73f1306--4fea-8fe2-a37771b471d5
Status: Started
Snapshot Count:
Number of Bricks:
Transport-type: tcp
Bricks:
Brick1: node101.yinzhengjie.org.cn:/home/yinzhengjie/glusterfs/file1
Brick2: node102.yinzhengjie.org.cn:/home/yinzhengjie/glusterfs/file1
Brick3: node101.yinzhengjie.org.cn:/home/yinzhengjie/glusterfs/file8        #这块磁盘就是咱们刚刚加上去的,注意生产环境操作基本上也是这样,只不过不是我们随手创建一个目录,而是把存储社保挂载到咱们指定到挂载点上而已!
Options Reconfigured:
transport.address-family: inet
nfs.disable: on
[root@node101 ~]#

2>.重新均衡扩展卷

  往卷中添加一块设备后,需要咱们手动均衡一下,否则数据不会往新设备上存储哟,具体操作如下:

[root@node101 ~]# gluster volume rebalance test-volume start              #重新均衡的适合需要等待一定的时间!
volume rebalance: test-volume: success: Rebalance on test-volume has been started successfully. Use rebalance status command to check status of the rebalance process.
ID: 7bd59481-af36-4fcc-9b04-9d421e4d6c0f
[root@node101 ~]#

3>.往卷中添加数据

[root@node101 ~]# ls  /home/yinzhengjie/glusterfs/file8/
[root@node101 ~]#
[root@node101 ~]#
[root@node101 ~]# touch /mnt/gluster1/{..}.txt
[root@node101 ~]#
[root@node101 ~]# ls /mnt/gluster1/
.txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt blog.txt
.txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt
.txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt
.txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt
[root@node101 ~]#
[root@node101 ~]#
[root@node101 ~]# ls /home/yinzhengjie/glusterfs/file8/
.txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt
[root@node101 ~]#
[root@node101 ~]#
[root@node101 ~]# ls /home/yinzhengjie/glusterfs/file1/
.txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt
.txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt blog.txt
[root@node101 ~]#
[root@node101 ~]#
[root@node101 ~]# ssh node102.yinzhengjie.org.cn
Last login: Mon Feb :: from node101.yinzhengjie.org.cn
[root@node102 ~]#
[root@node102 ~]# ls /home/yinzhengjie/glusterfs/file1/
.txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt
.txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt
.txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt .txt
[root@node102 ~]#

二.卷的缩容

  您可以根据需要在群集联机且可用时缩小卷。例如,您可能需要删除由于硬件或网络故障而在分布式卷中无法访问的块。

[root@node101 ~]# gluster volume info test-volume

Volume Name: test-volume
Type: Distribute
Volume ID: d73f1306--4fea-8fe2-a37771b471d5
Status: Started
Snapshot Count:
Number of Bricks:
Transport-type: tcp
Bricks:
Brick1: node101.yinzhengjie.org.cn:/home/yinzhengjie/glusterfs/file1
Brick2: node102.yinzhengjie.org.cn:/home/yinzhengjie/glusterfs/file1
Brick3: node101.yinzhengjie.org.cn:/home/yinzhengjie/glusterfs/file8
Options Reconfigured:
performance.client-io-threads: on
transport.address-family: inet
nfs.disable: on
[root@node101 ~]#
[root@node101 ~]# gluster volume remove-brick test-volume node101.yinzhengjie.org.cn:/home/yinzhengjie/glusterfs/file8 start
Running remove-brick with cluster.force-migration enabled can result in data corruption. It is safer to disable this option so that files that receive writes during migration are not migrated.
Files that are not migrated can then be manually copied after the remove-brick commit operation.
Do you want to continue with your current cluster.force-migration settings? (y/n) y        #这里会有一个提示,提示咱们可能存在数据丢失的风险,我输入y即可!由此可见官方并不推荐我们对GlusterFS进行缩容操作,对扩容操作倒是很支持呢!
volume remove-brick start: success
ID: 8e121850-c23b-4be3-94c4-c854148e5077
[root@node101 ~]#
[root@node101 ~]#
[root@node101 ~]# ls /home/yinzhengjie/glusterfs/file8/        #很显然这个目录对数据已经不再了,当然里面对数据会被转移走,这就是为什么执行上面的那条命令会等很长一段时间的缘由!
[root@node101 ~]#
[root@node101 gluster1]# gluster volume remove-brick test-volume node101.yinzhengjie.org.cn:/home/yinzhengjie/glusterfs/file8 status
Node Rebalanced-files size scanned failures skipped status run time in h:m:s  
--------- ----------- ----------- ----------- ----------- ----------- ------------ --------------
localhost 0Bytes completed ::      #大家看着一行的status的值,如果为completed时,则说明可以执行下面的一条命令了,官方网站是这么说的!
[root@node101 gluster1]#
[root@node101 gluster1]#
[root@node101 gluster1]# gluster volume remove-brick test-volume node101.yinzhengjie.org.cn:/home/yinzhengjie/glusterfs/file8 commit      #提交我们一处该块磁盘的操作
volume remove-brick commit: success
Check the removed bricks to ensure all files are migrated.
If files with data are found on the brick path, copy them via a gluster mount point before re-purposing the removed brick.
[root@node101 gluster1]#
[root@node101 gluster1]# gluster volume info test-volume            #再次查我们会发现node101.yinzhengjie.org.cn:/home/yinzhengjie/glusterfs/file8这个文块设备不见啦! Volume Name: test-volume
Type: Distribute
Volume ID: d73f1306--4fea-8fe2-a37771b471d5
Status: Started
Snapshot Count:
Number of Bricks:
Transport-type: tcp
Bricks:
Brick1: node101.yinzhengjie.org.cn:/home/yinzhengjie/glusterfs/file1
Brick2: node102.yinzhengjie.org.cn:/home/yinzhengjie/glusterfs/file1
Options Reconfigured:
performance.client-io-threads: on
transport.address-family: inet
nfs.disable: on
[root@node101 gluster1]#

  博主推荐阅读:https://docs.gluster.org/en/latest/Administrator%20Guide/Managing%20Volumes/

GlusterFS 分布式文件系统的使用入门-管理GlusterFS卷的更多相关文章

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

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

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

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

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

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

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

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

  5. GlusterFS 分布式文件系统

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

  6. CentOS7.5 GlusterFS 分布式文件系统集群环境搭建

    环境准备: 系统版本:CentOS Linux release 7.5.1804 (Core) glusterfs:3.6.9 userspace-rcu-master: 硬件资源: 10.200.2 ...

  7. 分布式文件系统MFS、Ceph、GlusterFS、Lustre的比较

    原文:http://blog.csdn.net/metaxen/article/details/7108958 MooseFS(MFS) Ceph GlusterFS Lustre Metadata ...

  8. glusterfs分布式文件系统

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

  9. glusterFS分布式文件系统的搭建

    准备工作 1.安装IBA yum install libradmacm librdmacm-devel libmlx4 infiniband-diags 2.配置IPOIB /etc/sysconfi ...

随机推荐

  1. Go语言类型的本质

    如果给这个类型增加或者删除某个值,是要创建一个新值,还是要更改当前的值? 如果是要创建一个新值,该类型的方法就使用值接收者. 如果是要修改当前值,就使用指针接收者. 这个答案也会影响程序内部传递这个类 ...

  2. python 模块之-time

    python 模块time import time # 1 time() :返回当前时间的时间戳 time.time() #1473525444.037215 #------------------- ...

  3. BZOJ2658 ZJOI2012 小蓝的好友(treap)

    显然转化为求不包含关键点的矩形个数.考虑暴力,枚举矩形下边界,求出该行每个位置对应的最低障碍点高度,对其建笛卡尔树,答案即为Σhi*(slson+1)*(srson+1),即考虑跨过该位置的矩形个数. ...

  4. POJ 3020 -Antenna Placement-二分图匹配

    题意:一个N*M的矩阵里有K个观测点,你必须放置天线覆盖所有观测点.每个雷达只能天线两个观测点,这两点必须相邻.计算最少天线数. 做法:将所有相邻的观测点连起来,建图.跑一遍匈牙利算法就计算出了最大的 ...

  5. Linux的Shell练习--个人笔记

    一. 实验准备(预防抄袭,此步必做) 1. 请将提示符设为:学号加波浪号.输入PS1=学号~,如PS1=110015~, 回车执行 2. 如发现提示符.学号不匹配, 视为抄袭或无效 二. 实验项目 1 ...

  6. Android短信大全

    使用ListView实现点击条目跳转短信界面,并将内容传至短信页面: 代码如下:activity_main.xml: <?xml version="1.0" encoding ...

  7. Django+Xadmin打造在线教育系统(九)

    xadmin的进阶开发 因版本问题.有些配置可能无效 自定义icon xadmin的图标采用的是第三方css样式font awesome,我们可以进官网下载最新的样式替代原本的,下载地址:http:/ ...

  8. 洛谷P4782 2-SAT问题

    2-SAT问题 这是一道2-SAT的模板题.对于2-SAT问题的每一个条件,我们需要把他们转化成可接受的条件.即"若变量A的赋值为x,则变量B的赋值为y",其中x,y均等于0或1. ...

  9. JeeSite4.x 搭建并部署到服务器

    1.下载地址:https://gitee.com/thinkgem/jeesite4 2.文档地址:http://jeesite4.mydoc.io/?t=267354 2.1一定要看,都很清晰,没废 ...

  10. Hdoj 2045.不容易系列之(3)—— LELE的RPG难题 题解

    Problem Description 人称"AC女之杀手"的超级偶像LELE最近忽然玩起了深沉,这可急坏了众多"Cole"(LELE的粉丝,即"可乐 ...