CentOS Stream 8
Sponsored Link

GlusterFS 8 : Set Quota2021/04/05

 
It's possible to limit Gluster volume usage or directory usage on a Gluster volume to set quota.
[1] Enable quota on taget GlusterFS volume you'd like to set.
[root@node01 ~]#
gluster volume quota vol_distributed enable

volume quota : success
[root@node01 ~]#
gluster volume info


Volume Name: vol_distributed
Type: Distribute
Volume ID: 725fb28f-5678-4c2d-86b7-ab8c0165c323
Status: Started
Snapshot Count: 0
Number of Bricks: 2
Transport-type: tcp
Bricks:
Brick1: node01:/glusterfs/distributed
Brick2: node02:/glusterfs/distributed
Options Reconfigured:
features.quota-deem-statfs: on
features.inode-quota: on
features.quota: on
performance.parallel-readdir: on
performance.readdir-ahead: on
performance.nl-cache-timeout: 600
performance.nl-cache: on
network.inode-lru-limit: 200000
performance.md-cache-timeout: 600
performance.cache-invalidation: on
performance.stat-prefetch: on
performance.cache-samba-metadata: on
features.cache-invalidation-timeout: 600
features.cache-invalidation: on
performance.write-behind: off
user.smb: enable
storage.fips-mode-rchecksum: on
transport.address-family: inet
nfs.disable: on

# to disable, set like follows

[root@node01 ~]#
gluster volume quota vol_distributed disable

[2] Set quota to the entire volume.
# for example, set 1GB quota to the entire [vol_distributed] volume

# gluster volume quota [volume name] limit-usage [path of target directory] [hard_limit]

[root@node01 ~]#
gluster volume quota vol_distributed limit-usage / 1GB

volume quota : success
[root@node01 ~]#
gluster volume quota vol_distributed list

                  Path                   Hard-limit  Soft-limit      Used  Available  Soft-limit exceeded? Hard-limit exceeded?
-------------------------------------------------------------------------------------------------------------------------------
/                                          1.0GB     80%(819.2MB) 512Bytes 1024.0MB              No                   No

# on a client, quota size is displayed as whole filesystem size

[root@client ~]#
df -h /mnt

Filesystem                         Size  Used Avail Use% Mounted on
node01.srv.world:/vol_distributed  1.0G     0  1.0G   0% /mnt

# if you'd like to see whole disk size even on a client, not display quota size,

# turn off [quota-deem-statfs] parameter on a GlusterFS volume node

[root@node01 ~]#
gluster volume set vol_distributed quota-deem-statfs off

[3] Set quota to a directory on a volume.
# for example, set 1GB quota to [/dir01] directory on [vol_distributed] volume

[root@node01 ~]#
gluster volume quota vol_distributed limit-usage /dir01 1GB

volume quota : success
[root@node01 ~]#
gluster volume quota vol_distributed list

                  Path                   Hard-limit  Soft-limit      Used  Available  Soft-limit exceeded? Hard-limit exceeded?
-------------------------------------------------------------------------------------------------------------------------------
/dir01                                     1.0GB     80%(819.2MB)   0Bytes   1.0GB              No                   No

# on a client, quota size is displayed as whole directory size

[root@client ~]#
df -h /mnt/dir01

Filesystem                         Size  Used Avail Use% Mounted on
node01.srv.world:/vol_distributed  1.0G     0  1.0G   0% /mnt
[4] Set specific soft limit to a quota setting.
# for example, set 1GB quota to [/dir01] directory on [vol_distributed] volume and set 70% soft limit

# gluster volume quota [volume name] limit-usage [path of target directory] [hard_limit] [soft_limit]

[root@node01 ~]#
gluster volume quota vol_distributed limit-usage /dir01 1GB 70

volume quota : success
[root@node01 ~]#
gluster volume quota vol_distributed list

                  Path                   Hard-limit  Soft-limit      Used  Available  Soft-limit exceeded? Hard-limit exceeded?
-------------------------------------------------------------------------------------------------------------------------------
/dir01                                     1.0GB     70%(716.8MB)   0Bytes   1.0GB              No                   No
[5] To delete quota, run command like follows.
# for example, delete quota on [vol_distributed] volume

[root@node01 ~]#
gluster volume quota vol_distributed remove /

volume quota : success
[root@node01 ~]#
gluster volume quota vol_distributed list

quota: No quota configured on volume vol_distributed
Matched Content