ClusterStorage-5-配置ACLs与Quotas之设置Quotas

本文详细介绍了如何使用 GlusterFS 进行定额管理,包括环境检查与配置、配置定额、设置超时、配置选项以及测试限制功能等步骤。通过实际操作演示了如何挂载目录、设置定额限制、测试写入限制等关键流程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

0.实验前的环境检查与配置

[student@workstation ~]$ lab quotas setup
 

1.配置定额

mount | grep graphics查看已经挂载的目录。umount /mnt/graphics取消挂载。gluster volume quota graphics enable启动定额控制。gluster volume quota graphics limit-usage /raw 1GB 50%设置子目录的硬件限制与软件限制。gluster volume quota graphics list显示定额列表。

[root@workstation ~]# mount | grep graphics
servera:/graphics on /mnt/graphics type fuse.glusterfs (rw,relatime,user_id=0,group_id=0,allow_other,max_read=131072)
[root@workstation ~]# umount /mnt/graphics
[root@servera ~]# gluster volume quota graphics enable
volume quota : success
[root@servera ~]# gluster volume quota graphics limit-usage /raw 1GB 50%
volume quota : success

[root@servera ~]# gluster volume quota graphics list
                  Path                   Hard-limit  Soft-limit      Used  Available  Soft-limit exceeded? Hard-limit exceeded?
-------------------------------------------------------------------------------------------------------------------------------
/raw                                       1.0GB     50%(512.0MB)   0Bytes   1.0GB              No                   No
 

2.配置超时

gluster volume quota graphics soft-timeout 5s设置软件超时。gluster volume quota graphics hard-timeout 1s设置硬件超时。

[root@servera ~]# gluster volume quota graphics soft-timeout 5s
volume quota : success
[root@servera ~]# gluster volume quota graphics hard-timeout 1s
volume quota : success
 

3.配置选项

gluster volume set help | grep quota-deem-statfs -A2查看开关的意义(控制文件系统大小限制的功能)。gluster volume set graphics quota-deem-statfs on把功能开启。

[root@servera ~]# gluster volume set help | grep quota-deem-statfs -A2
Option: features.quota-deem-statfs
Default Value: off
Description: If set to on, it takes quota limits intoconsideration while estimating fs size. (df command) (Default is off).
[root@servera ~]# gluster volume set graphics quota-deem-statfs on
volume set: success

 

4.测试限制功能

mount /mnt/graphics挂载目录。mount | grep graphics确认已经挂载。dd if=/dev/zero of=/mnt/graphics/raw/testfile bs=1M测试写入(直到超过限额后会报提醒)。ls -lh /mnt/graphics/raw/testfile监测写入过程。

[root@workstation ~]# mount /mnt/graphics
[root@workstation ~]# mount | grep graphics
servera:/graphics on /mnt/graphics type fuse.glusterfs (rw,relatime,user_id=0,group_id=0,allow_other,max_read=131072)
[root@workstation ~]# dd if=/dev/zero of=/mnt/graphics/raw/testfile bs=1M
dd: error writing ‘/mnt/graphics/raw/testfile’: Disk quota exceeded
dd: closing output file ‘/mnt/graphics/raw/testfile’: Disk quota exceeded
[root@workstation ~]# ls -lh /mnt/graphics/raw/testfile
-rw-r--r--. 1 root root 253M Jan 26 23:20 /mnt/graphics/raw/testfile
[root@workstation ~]# ls -lh /mnt/graphics/raw/testfile
-rw-r--r--. 1 root root 768M Jan 26 23:22 /mnt/graphics/raw/testfile
[root@workstation ~]# ls -lh /mnt/graphics/raw/testfile
-rw-r--r--. 1 root root 849M Jan 26 23:22 /mnt/graphics/raw/testfile
[root@workstation ~]# ls -lh /mnt/graphics/raw/testfile
-rw-r--r--. 1 root root 1014M Jan 26 23:23 /mnt/graphics/raw/testfile
[root@workstation ~]# rm /mnt/graphics/raw/testfile
rm: remove regular file ‘/mnt/graphics/raw/testfile’? y
 

5.任务测评

lab quotas grade进行测评。测评包括:挂载目录,挂载与取消挂载,选项功能,定额是否启动,定额限制,软件超时,硬件超时等功能。

[student@workstation ~]$ lab quotas grade

Grading the student's work:

 · Testing if all hosts are reachable..........................  SUCCESS
 · Checking for current mount on /mnt/graphics on workstation..  PASS
 · Checking if /mnt/graphics on workstation is in use..........  PASS
 · Unmounting /mnt/graphics....................................  PASS
 · Mounting /mnt/graphics......................................  PASS
 · Checking for current mount on /mnt/graphics on workstation..  PASS
 · Checking mount options for /mnt/graphics in /etc/fstab......  PASS
 · Testing if quotas are enabled for graphics..................  PASS
 · Testing quota limits........................................  PASS
 · Checking for quota reporting in 'df'........................  PASS
 · Checking soft timeouts......................................  PASS
 · Checking hard timeouts......................................  PASS

Overall lab grade..............................................  PASS
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值