CentOS 8
Sponsored Link

GlusterFS 8 : Set Quota2020/12/01

 
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: 19c1760d-ea06-4ba7-b6ea-ef33d7a1f64b
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
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 entire volume.
# for example, set 1GB quota to 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)  908.0MB 116.0MB             Yes                   No

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

[root@client ~]#
df -h

Filesystem                         Size  Used Avail Use% Mounted on
node01.srv.world:/vol_distributed  1.0G  908M  116M  89% /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