Managing Directory Quota
Directory quotas in GlusterFS allows you toset limits on usage of the disk space by directories or volumes. The storageadministrators can control the disk space utilization at the directory and/orvolume levels in GlusterFS by setting limits to allocatable disk space at anylevel in the volume and directory hierarchy. This is particularly useful incloud deployments to facilitate utility billing model.
Note For now, only Hard limits are
supported. Here, the limit cannot be exceeded and attempts to use more disk
space or inodes beyond the set limit is denied. #硬限制
System administrators can also monitor theresource utilization to limit the storage for the users depending on their rolein the organization.
You can set the quota at the following
levels:设置步骤:
两种级别:
Directory level – limits the usage at thedirectory level#目录级别
Volume level – limits the usage at thevolume level# volume级别
Note You can set the disk limit on thedirectory even if it is not created. The disk limit is enforced immediatelyafter creating that directory.
Enabling Quota#开启限额
You must enable Quota to set disk limits.
Toenable quota:
Use the following command to enable quota:
# gluster volume quotaenable
For example, to enable quota on the test-volume:
# gluster volume quota test-volume enable
Quota is enabled on /test-volume
注意事项:
这里test的路径为:
[root@node1
test]#pwd
/mnt/gluster/test
#我们的挂载点为/mnt/gluster,所以设置限额的路径为/test
[root@node1
gluster]#gluster volume quota testvol limit-usage/test1000000000
volume quota : success
[root@node1
gluster]#gluster volume quota testvol list
PathHard-limitSoft-limitUsedAvailableSoft-limit exceeded?Hard-limit exceeded?
-------------------------------------------------------------------------------------------------------------------------------
/test953.7MB80%(762.9MB)0Bytes 953.7MBNoNo
Disabling Quota
You can disable Quota, if needed.
To
disable quota: #取消限额
Use the following command to disable quota:
# gluster volumequotadisable
For example, to disable quota translator onthe test-volume:
# gluster volume quota test-volume disable
Quota translator is disabled on /test-volume
Setting or Replacing Disk Limit设置和重新设置限额
You can create new directories in yourstorage environment and set the disk limit or set disk limit for the existing directories.The directory name should be relative to the volume with the exportdirectory/mount being treated as "/".
Toset or replace disk limit:
Set the disk limit using the following command:
# gluster volume quotalimit-usage /
For example, to set limit on data directory on the test-volume wheredata is a directory under the export directory:
# gluster volume quota test-volume limit-usage /data 10GB
Usage limit hasbeen set on /data
[root@node1 test]#gluster volume quota testvol limit-usage /test1000000032#重新修改为需要的限额大小
volume quota : success
You can display disk limit information onall the directories on which the limit is set.
To display disk limit information:
Display disk limit information of all the directories on which limitis set, using the following command:
# gluster volume quotalist
For example, to see the set disks limit on the test-volume:#volume的磁盘限额
# gluster volume quotatest-volume list
/Test/data10 GB6 GB
/Test/data110 GB4 GB
Display disk limit information on a particular directory on whichlimit is set, using the following command:
# gluster volume quotalist
For example, to view the set limit on /data directory oftest-volume:#目录的磁盘限额
# gluster volume quotatest-volume list /data
/Test/data10 GB6 GB
Displaying Quota Limit Information Using the dfUtility
You can create a report of the disk usageusing the df utility by taking quota limits into consideration. To generate areport, run the following command:
#gluster volume set VOLNAME quota-deem-statfs on
In this case, the total disk space of thedirectory is taken as the quota hard limit set on the directory of the volume.
Note The default value forquota-deem-statfs is off. However, it is recommended to set quota-deem-statfsto on.
The following example displays the diskusage when quota-deem-statfs is off:
#gluster volume set test-volume features.quota-deem-statfs off
volume set: success
#gluster volume quota test-volume list
PathHard-limitSoft-limitUsedAvailable
-----------------------------------------------------------
/300.0GB90%11.5GB288.5GB
/John/Downloads 77.0GB75%11.5GB65.5GB
Disk usage for volume test-volume as seenon client1:
#df -hT /home
FilesystemTypeSizeUsed Avail Use% Mounted on
server1:/test-volume fuse.glusterfs400G12G389G3% /home
The following example displays the diskusage when quota-deem-statfs is on:
#gluster volume set test-volume features.quota-deem-statfs on
volume set: success
#gluster vol quota test-volume list
PathHard-limitSoft-limitUsedAvailable
-----------------------------------------------------------
/300.0GB90%11.5GB288.5GB
/John/Downloads 77.0GB75%11.5GB65.5GB
Disk usage for volume test-volume as seenon client1:
#df -hT /home
FilesystemTypeSizeUsed Avail Use% Mounted on
server1:/test-volumefuse.glusterfs300G12G289G4% /home
The quota-deem-statfs option when set toon, allows the administrator to make the user view the total disk spaceavailable on the directory as the hard limit set on it.
Updating Memory Cache Size
Setting Timeout
For performance reasons, quota caches thedirectory sizes on client. You can set timeout indicating the maximum validduration of directory sizes in cache, from the time they are populated.
For example: If there are multiple clientswriting to a single directory, there are chances that some other client mightwrite till the quota limit is exceeded. However, this new file-size may not getreflected in the client till size entry in cache has become stale because oftimeout. If writes happen on this client during this duration, they are allowedeven though they would lead to exceeding of quota-limits, since size in cacheis not in sync with the actual size. When timeout happens, the size in cache isupdated from servers and will be in sync and no further writes will be allowed.A timeout of zero will force fetching of directory sizes from server for everyoperation that modifies file data and will effectively disables directory sizecaching on client side.
To update the memory cache size:
Use the following command to update thememory cache size:
# gluster volume setfeatures.quota-timeout
For example, to update the memory cachesize for every 5 seconds on test-volume:
# gluster volume set test-volumefeatures.quota-timeout 5
Set volume successful
Setting Alert Time
Alert time is the frequency at which youwant your usage information to be logged after you reach the soft limit.
To set the alert time:
Use the following command to set the alerttime:
# gluster volume quota VOLNAME alert-timetime
Note
The default alert-time is one week.
For example, to set the alert time to oneday:
# gluster volume quota test-volumealert-time 1d
volume quota : success
RemovingDisk Limit
You can remove set disk limit, if you donot want quota anymore.
To remove disk limit:
Use the following command to remove thedisk limit set on a particular directory:
# gluster volume quotaremove
For example, to remove the disk limit on/data directory of test-volume:
# gluster volume quota test-volume remove/data
Usage limit set son /data is removed
�|�}=�k@�