HDFS配额管理通过设置名称配额、空间配额和存储类型配额来实现,具体如下:
hdfs dfsadmin -setQuota <N> <directory>设置,<N>为最大数量,用-clrQuota <directory>清除。如hdfs dfsadmin -setQuota 100 /logs/daily限制该目录下文件和子目录最多100个。hdfs dfsadmin -setSpaceQuota <N> <directory>设置,<N>为字节数,可用二进制前缀,如hdfs dfsadmin -setSpaceQuota 10G /user/tmp限制该目录使用10GB空间。用-clrSpaceQuota <directory>清除。hdfs dfsadmin -setSpaceQuota <N> -storageType <storagetype> <directory>设置,如hdfs dfsadmin -setSpaceQuota 200G -storageType SSD /user/realtime,用-clrSpaceQuota -storageType <storagetype> <directory>清除。可使用hdfs dfs -count -q <directory>查看配额使用情况,-h以人类可读格式显示,-v显示标题行。