GlusterFS学习之路(三)客户端挂载和管理GlusterFS卷
一、客户端挂载
可以使用Gluster Native Client方法在GNU / Linux客户端中实现高并发性,性能和透明故障转移。可以使用NFS v3访问gluster卷。已经对GNU / Linux客户端和其他操作系统中的NFS实现进行了广泛的测试,例如FreeBSD,Mac OS X,以及Windows 7(Professional和Up)和Windows Server 2003.其他NFS客户端实现可以与gluster一起使用NFS服务器。使用Microsoft Windows以及SAMBA客户端时,可以使用CIFS访问卷。对于此访问方法,Samba包需要存在于客户端。
总结:GlusterFS支持三种客户端类型。Gluster Native Client、NFS和CIFS。Gluster Native Client是在用户空间中运行的基于FUSE的客户端,官方推荐使用Native Client,可以使用GlusterFS的全部功能。
- 1、使用Gluster Native Client挂载
Gluster Native Client是基于FUSE的,所以需要保证客户端安装了FUSE。这个是官方推荐的客户端,支持高并发和高效的写性能。
在开始安装Gluster Native Client之前,您需要验证客户端上是否已加载FUSE模块,并且可以访问所需的模块,如下所示:
[root@localhost ~]# modprobe fuse #将FUSE可加载内核模块(LKM)添加到Linux内核
[root@localhost ~]# dmesg | grep -i fuse #验证是否已加载FUSE模块
[ 569.630373] fuse init (API version 7.22)
安装Gluseter Native Client:
[root@localhost ~]# yum -y install glusterfs-client #安装glusterfs-client客户端
[root@localhost ~]# mkdir /mnt/glusterfs #创建挂载目录
[root@localhost ~]# mount.glusterfs 192.168.56.11:/gv1 /mnt/glusterfs/ #挂载/gv1
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 20G .4G 19G % /
devtmpfs 231M 231M % /dev
tmpfs 241M 241M % /dev/shm
tmpfs 241M 4.6M 236M % /run
tmpfs 241M 241M % /sys/fs/cgroup
/dev/sda1 197M 97M 100M % /boot
tmpfs 49M 49M % /run/user/
192.168.56.11:/gv1 .0G 312M .7G % /mnt/glusterfs
[root@localhost ~]# ll /mnt/glusterfs/ #查看挂载目录的内容
total
-rw-r--r-- root root Aug : 100M.file
[root@localhost ~]# mount #查看挂载信息
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
......
192.168.56.11:/gv1 on /mnt/glusterfs type fuse.glusterfs (rw,relatime,user_id=,group_id=,default_permissions,allow_other,max_read=)
手动挂载卷选项:
使用该mount -t glusterfs
命令时,可以指定以下选项 。请注意,您需要用逗号分隔所有选项。
backupvolfile-server=server-name #在安装fuse客户端时添加了这个选择,则当第一个vofile服务器故障时,该选项执行的的服务器将用作volfile服务器来安装客户端 volfile-max-fetch-attempts=number of attempts 指定在装入卷时尝试获取卷文件的尝试次数。 log-level=loglevel #日志级别 log-file=logfile #日志文件 transport=transport-type #指定传输协议 direct-io-mode=[enable|disable] use-readdirp=[yes|no] #设置为ON,则强制在fuse内核模块中使用readdirp模式 举个例子:
# mount -t glusterfs -o backupvolfile-server=volfile_server2,use-readdirp=no,volfile-max-fetch-attempts=2,log-level=WARNING,log-file=/var/log/gluster.log server1:/test-volume /mnt/glusterfs
自动挂载卷:
除了使用mount挂载,还可以使用/etc/fstab自动挂载
语法格式:HOSTNAME-OR-IPADDRESS:/VOLNAME MOUNTDIR glusterfs defaults,_netdev 举个例子:
192.168.56.11:/gv1 /mnt/glusterfs glusterfs defaults,_netdev
二、管理GlusterFS卷
(1)停止卷
[root@gluster-node1 ~]# gluster volume stop gv1
(2)删除卷
[root@gluster-node1 ~]# gluster volume delete gv1
(3)扩展卷
GlusterFS支持在线进行卷的扩展。
如果添加的节点还不是集群中的节点,需要使用下面命令添加到集群
语法:# gluster peer probe <SERVERNAME>
扩展卷语法:# gluster volume add-brick <VOLNAME> <NEW-BRICK>
[root@gluster-node1 ~]# gluster peer probe gluster-node3 #添加gluster-node3到集群
peer probe: success. [root@gluster-node1 ~]# gluster volume add-brick test-volume gluster-node3:/storage/brick1 force #扩展test-volume卷
volume add-brick: success
[root@gluster-node1 ~]# gluster volume info Volume Name: test-volume
Type: Distribute
Volume ID: 26a625bb-301c--a382-0a838ee63935
Status: Started
Snapshot Count:
Number of Bricks:
Transport-type: tcp
Bricks:
Brick1: gluster-node1:/storage/brick1
Brick2: gluster-node2:/storage/brick1
Brick3: gluster-node3:/storage/brick1 #增加的brick
Options Reconfigured:
transport.address-family: inet
nfs.disable: on [root@gluster-node1 ~]# gluster volume rebalance test-volume start #添加后,重新平衡卷以确保文件分发到新添加的brick
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: ca58bd21-11a5--bb2a-8f9079982394
(4)收缩卷
收缩卷和扩展卷相似据以Brick为单位。
语法:# gluster volume remove-brick <VOLNAME> <BRICKNAME> start
[root@gluster-node1 ~]# gluster volume remove-brick test-volume gluster-node3:/storage/brick1 start #删除brick
volume remove-brick start: success
ID: dd0004f0-b3e6-45d6-80ed-90506dc16159
[root@gluster-node1 ~]# gluster volume remove-brick test-volume gluster-node3:/storage/brick1 status #查看remove brick操作的状态
Node Rebalanced-files size scanned failures skipped status run time in h:m:s
--------- ----------- ----------- ----------- ----------- ----------- ------------ --------------
gluster-node3 0Bytes completed ::
[root@gluster-node1 ~]# gluster volume remove-brick test-volume gluster-node3:/storage/brick1 commit #显示completed状态后,提交remove-brick操作
volume remove-brick commit: success
[root@gluster-node1 ~]# gluster volume info Volume Name: test-volume
Type: Distribute
Volume ID: 26a625bb-301c--a382-0a838ee63935
Status: Started
Snapshot Count:
Number of Bricks:
Transport-type: tcp
Bricks:
Brick1: gluster-node1:/storage/brick1
Brick2: gluster-node2:/storage/brick1
Options Reconfigured:
performance.client-io-threads: on
transport.address-family: inet
nfs.disable: on
(5)迁移卷
要替换分布式卷上的brick,需要添加一个新的brick,然后删除要替换的brick。在替换的过程中会触发重新平衡的操作,会将移除的brick中的数据到新加入的brick中。
注意:这里仅支持可以对分布式复制卷或复制卷使用"replace-brick"命令进行替换操作。
(1)初始卷test-volume的配置信息
[root@gluster-node1 gv1]# gluster volume info Volume Name: test-volume
Type: Distribute
Volume ID: 26a625bb-301c--a382-0a838ee63935
Status: Started
Snapshot Count:
Number of Bricks:
Transport-type: tcp
Bricks:
Brick1: gluster-node1:/storage/brick1
Brick2: gluster-node2:/storage/brick1
Options Reconfigured:
performance.client-io-threads: on
transport.address-family: inet
nfs.disable: on
(2)test-volume挂载目录的文件和在实际存储位置的文件信息
[root@gluster-node1 gv1]# ll
total
-rw-r--r-- root root Aug : file1
-rw-r--r-- root root Aug : file2
-rw-r--r-- root root Aug : file3
-rw-r--r-- root root Aug : file4
-rw-r--r-- root root Aug : file5 [root@gluster-node1 gv1]# ll /storage/brick1/
total
-rw-r--r-- root root Aug : file1
-rw-r--r-- root root Aug : file2
-rw-r--r-- root root Aug : file5 [root@gluster-node2 ~]# ll /storage/brick1/
total
-rw-r--r-- root root Aug file3
-rw-r--r-- root root Aug file4 (3)添加新brick gluster-node3:/storage/brick1
[root@gluster-node1 ~]# gluster volume add-brick test-volume gluster-node3:/storage/brick1/ force
volume add-brick: success
(4)启动remove-brick
[root@gluster-node1 ~]# gluster volume remove-brick test-volume gluster-node2:/storage/brick1 start
volume remove-brick start: success
ID: 2acdaebb-25a9-477c-807e-980a6086796e
(5)查看remove-brick的状态是否为completed
[root@gluster-node1 ~]# gluster volume remove-brick test-volume gluster-node2:/storage/brick1 status
Node Rebalanced-files size scanned failures skipped status run time in h:m:s
--------- ----------- ----------- ----------- ----------- ----------- ------------ --------------
gluster-node2 0Bytes completed ::
(6)确认删除旧的brick
[root@gluster-node1 ~]# gluster volume remove-brick test-volume gluster-node2:/storage/brick1 commit
volume remove-brick commit: success
(7)test-volume的最新配置
[root@gluster-node1 ~]# gluster volume info Volume Name: test-volume
Type: Distribute
Volume ID: 26a625bb-301c--a382-0a838ee63935
Status: Started
Snapshot Count:
Number of Bricks:
Transport-type: tcp
Bricks:
Brick1: gluster-node1:/storage/brick1
Brick2: gluster-node3:/storage/brick1
Options Reconfigured:
performance.client-io-threads: on
transport.address-family: inet
nfs.disable: on
(8)检查新增brick的文件存储信息,原先存储在gluster-node2节点的文件移动到了gluster-node3中
[root@gluster-node3 ~]# ll /storage/brick1/
total
-rw-r--r-- root root Aug file3
-rw-r--r-- root root Aug file4
(6)系统配额
[root@gluster-node1 ~]# gluster volume quota test-volume enable #启用配额
volume quota : success [root@gluster-node1 ~]# gluster volume quota test-volume disable #禁用配额
volume quota : success [root@gluster-node1 ~]# mount -t glusterfs 127.0.0.1:/test-volume /gv1 #挂载test-volume卷
[root@gluster-node1 ~]# mkdir /gv1/quota #创建限制的目录
[root@gluster-node1 ~]# gluster volume quota test-volume limit-usage /quota 10MB #对/gv1/quota目录限制 [root@gluster-node1 ~]# gluster volume quota test-volume list #查看目录限制信息
Path Hard-limit Soft-limit Used Available Soft-limit exceeded? Hard-limit exceeded?
-------------------------------------------------------------------------------------------------------------------------------
/quota .0MB %(.0MB) 0Bytes .0MB No No [root@gluster-node1 ~]# gluster volume set test-volume features.quota-timeout #设置信息的超时时间 [root@gluster-node1 quota]# cp /gv1/20M.file . #拷贝20M文件到/gv1/quota下,已经超出了限额,但是依旧可以成功,由于限制的值较小,可能受到算法的影响
[root@gluster-node1 quota]# cp /gv1/20M.file ./20Mb.file #再拷贝20M的文件,就会提示超出目录限额
cp: cannot create regular file ‘./20Mb.file’: Disk quota exceeded [root@gluster-node1 gv1]# gluster volume quota test-volume remove /quota #删除某个目录的quota设置
volume quota : success
备注:
quota功能,主要是对挂载点下的某个目录进行空间限额,如:/mnt/glusterfs/data目录,而不是对组成卷组的空间进行限制。
(7)I/O信息查看
Profile Command 提供接口查看一个卷中的每一个brick的IO信息。
[root@gluster-node1 ~]# gluster volume profile test-volume start #启动profiling,之后则可以进行IO信息查看
Starting volume profile on test-volume has been successful
[root@gluster-node1 ~]# gluster volume profile test-volume info #查看IO信息,可以查看到每个brick的IO信息
Brick: gluster-node1:/storage/brick1
------------------------------------
Cumulative Stats:
Block Size: 32768b+ 131072b+
No. of Reads:
No. of Writes:
%-latency Avg-latency Min-Latency Max-Latency No. of calls Fop
--------- ----------- ----------- ----------- ------------ ----
0.00 0.00 us 0.00 us 0.00 us FORGET
0.00 0.00 us 0.00 us 0.00 us RELEASE
0.00 0.00 us 0.00 us 0.00 us RELEASEDIR Duration: seconds
Data Read: bytes
Data Written: bytes Interval Stats: Duration: seconds
Data Read: bytes
Data Written: bytes Brick: gluster-node3:/storage/brick1
------------------------------------
Cumulative Stats:
Block Size: 1024b+ 2048b+ 4096b+
No. of Reads:
No. of Writes: Block Size: 8192b+ 16384b+ 32768b+
No. of Reads:
No. of Writes: Block Size: 65536b+ 131072b+
No. of Reads:
No. of Writes:
%-latency Avg-latency Min-Latency Max-Latency No. of calls Fop
--------- ----------- ----------- ----------- ------------ ----
0.00 0.00 us 0.00 us 0.00 us RELEASE
0.00 0.00 us 0.00 us 0.00 us RELEASEDIR Duration: seconds
Data Read: bytes
Data Written: bytes Interval Stats: Duration: seconds
Data Read: bytes
Data Written: bytes
[root@gluster-node1 ~]# gluster volume profile test-volume stop #查看结束后关闭profiling功能
Stopping volume profile on test-volume has been successful
(8)Top监控
Top command 允许你查看bricks的性能例如:read, write, file open calls, file read calls, file write calls, directory open calls, and directory real calls
所有的查看都可以设置top数,默认100
# gluster volume top VOLNAME open [brick BRICK-NAME] [list-cnt] //查看打开的fd [root@gluster-node1 ~]# gluster volume top test-volume open brick gluster-node1:/storage/brick1 list-cnt
Brick: gluster-node1:/storage/brick1
Current open fds: , Max open fds: , Max openfd time: -- ::24.099217
Count filename
=======================
/.txt
/.txt
/.txt # gluster volume top VOLNAME read [brick BRICK-NAME] [list-cnt] //查看调用次数最多的读调用 [root@gluster-node1 ~]# gluster volume top test-volume read brick gluster-node3:/storage/brick1
Brick: gluster-node3:/storage/brick1
Count filename
=======================
/20M.file # gluster volume top VOLNAME write [brick BRICK-NAME] [list-cnt] //查看调用次数最多的写调用 [root@gluster-node1 ~]# gluster volume top test-volume write brick gluster-node3:/storage/brick1
Brick: gluster-node3:/storage/brick1
Count filename
=======================
/20M.file # gluster volume top VOLNAME opendir [brick BRICK-NAME] [list-cnt] # gluster volume top VOLNAME readdir [brick BRICK-NAME] [list-cnt] //查看次数最多的目录调用 [root@gluster-node1 ~]# gluster volume top test-volume opendir brick gluster-node3:/storage/brick1
Brick: gluster-node3:/storage/brick1
Count filename
=======================
/quota [root@gluster-node1 ~]# gluster volume top test-volume readdir brick gluster-node3:/storage/brick1
Brick: gluster-node3:/storage/brick1
Count filename
=======================
/quota # gluster volume top VOLNAME read-perf [bsblk-size count count] [brick BRICK-NAME] [list-cnt] //查看每个Brick的读性能 [root@gluster-node1 ~]# gluster volume top test-volume read-perf bs count brick gluster-node3:/storage/brick1
Brick: gluster-node3:/storage/brick1
Throughput 42.67 MBps time 0.0000 secs
MBps Filename Time
==== ======== ====
/20M.file -- ::24.7443 # gluster volume top VOLNAME write-perf [bsblk-size count count] [brick BRICK-NAME] [list-cnt] //查看每个Brick的写性能 [root@gluster-node1 ~]# gluster volume top test-volume write-perf bs count brick gluster-node1:/storage/brick1
Brick: gluster-node1:/storage/brick1
Throughput 16.00 MBps time 0.0000 secs
MBps Filename Time
==== ======== ====
/quota/20Mb.file -- ::21.957635
/quota/20M.file -- ::02.767068
GlusterFS学习之路(三)客户端挂载和管理GlusterFS卷的更多相关文章
- 学习之路三十九:新手学习 - Windows API
来到了新公司,一开始就要做个程序去获取另外一个程序里的数据,哇,挑战性很大. 经过两周的学习,终于搞定,主要还是对Windows API有了更多的了解. 文中所有的消息常量,API,结构体都整理出来了 ...
- Redis——学习之路三(初识redis config配置)
我们先看看config 默认情况下系统是怎么配置的.在命令行中输入 config get *(如图) 默认情况下有61配置信息,每一个命令占两行,第一行为配置名称信息,第二行为配置的具体信息. ...
- GlusterFS学习之路(二)GlusterFS部署及卷类型使用
一.环境说明 主机名 IP地址 角色 磁盘 gluster-node1 192.168.56.11 Server.Client /dev/sdb./dev/sdc./dev/sdd gluster-n ...
- GlusterFS学习之路(一)GlusterFS初识
一.GlusterFS简介 GlusterFS是Scale-Out存储解决方案Gluster的核心,它是一个开源的分布式文件系统,具有强大的横向扩展能力,通过扩展能够支持数PB存储容量和处理数千客户端 ...
- zigbee学习之路(三):按键的控制
一.前言 通过前一次的实验,相信大家都已经对cc2530程序的编写有了一定的认识,这次我们来操作和实验的是cc2530上的按键模块. 二.原理分析 我们先来看一下按键的原理图: 根据原理图我们可以得出 ...
- 学习之路三十二:VS调试的简单技巧
这段时间园子里讲了一些关于VS的快捷键以及一些配置技巧,挺好的,大家一起学习,一起进步. 这段时间重点看了一下关于VS调试技巧方面的书,在此记录一下学习的内容吧,主要还是一些比较浅显的知识. 1. 调 ...
- 学习之路三十五:Android和WCF通信 - 大数据压缩后传输
最近一直在优化项目的性能,就在前几天找到了一些资料,终于有方案了,那就是压缩数据. 一丶前端和后端的压缩和解压缩流程 二丶优点和缺点 优点:①字符串的压缩率能够达到70%-80%左右 ②字符串数量更少 ...
- 交互原型设计软件axure rp学习之路(三)
(三)Axure rp元件的触发事件 l OnClick(点击时): 鼠标点击事件,除了动态面板的所有的其他元件的点击时触发.比如点击按钮. l OnMouseEnter(鼠标移入时): 鼠标进入 ...
- IOS7学习之路三(UISpriteKit游戏开发SKNode)
ios7新添加了自己的游戏开发框架UISpriteKit ,可以用此做一些2D的小游戏, 今天学习了一下SKNode的知识做一下笔记,以便以后查阅. 1.SKNode继承自UIResponder. 2 ...
随机推荐
- 寄存器简介 与 ebp esp
http://www.cnblogs.com/zhuyuanhao/archive/2012/10/16/3262870.html 32位CPU所含有的寄存器有:4个数据寄存器(EAX.EBX.ECX ...
- TP框架---Model模型层---做模型对象
TP框架----Model模型层---------------做模型对象 Model模型层是用来做什么的呢???? 主要是用来做操作数据库访问的. 也就说明TP框架自带了一种访问数据库的方式,使用的是 ...
- 【Git】本地与GitHub同步
按步骤一步一步来,成功啦~ 以管理员身份运行Git-bash 要求输入用户名,密码 成功推入github~~加油加油 补充: 将仓库中的改动同步到本地 在git-bash中进入项目目录下,使用git ...
- [Python web开发] Web框架开发基础 (一)
Python WEB框架 WSGI,WEB Server Gateway Interface,可以看做是一种底层协议,它规定了服务器程序和应用程序各自实现上面接口.Python的实现称为wsgiref ...
- LORA芯片SX1272IMLTRT资料介绍
升特公司(Semtech)(纳斯达克:SMTC)日前推出新型远程RFIC平台的首款产品SX1272,可将器件的无线传输距离扩大至15公里. 该器件集成了升特公司的新型LoRa(远程)调制技术,相比其他 ...
- windows系统安装erlang
1.什么是erlang erlang是一种通用的面向并发的编程语言,它由瑞典电信设备制造商爱立信所辖的CS-Lab开发,目的是创造一种可以应对大规模并发活动的编程语言和运行环境.Erlang是一个结构 ...
- Spring @Value 默认值
@Value(value = "${etl.maxthreadcount:3}") private long MaxThreadCount;
- JavaScript(jQuery)中的事件委托
一:什么是事件委托? 事件委托是利用事件冒泡,只指定一个事件处理程序来管理某一类型的所有事件. 二:为什么要用事件委托? 1.在JavaScript中添加到页面上的事件处理程序的个数直接关系到页面的整 ...
- 结构体 内存对齐 keil & STM32
直接 上图 不废话: 第二张图: 把16位 类型的数据 换成 数组 ,这样 达到 节约内存和 方便处理 缓冲区数据
- 创建ASM实例及ASM数据库(转载)
--======================== -- 创建ASM实例及ASM数据库 --======================== 一.ASM相关概念 1.什么是ASM(Auto Stor ...