quota分为两种:
1. 目录下的文件数限制
2. 目录下的空间大小
//设置文件数
hdfs dfsadmin -setQuota 1000000 /user/jenkin
//设置空间大小
hdfs dfsadmin -setSpaceQuota 100g /user/jenkin //查看quota
hadoop fs -count -q /user/jenkin
[root@hadoop01 ~]# hadoop fs -count -q /user/jenkin
1000000 999182 107374182400 100052379973 26 792 2440600809 /user/jenkin
列对应:
QUOTA REMAINING_QUOTA SPACE_QUOTA REMAINING_SPACE_QUOTA DIR_COUNT FILE_COUNT
计算公式:
QUOTA – (DIR_COUNT + FILE_COUNT) = REMAINING_QUOTA
SPACE_QUOTA – CONTENT_SIZE = REMAINING_SPACE_QUOTA
space quota 的设定所看的不是上传的档案大小,是写入 HDFS 的所有 block size,假设一个档案要写入两个blocks,在core-site.xml设定dfs.block.size为64MB,dfs.replication为3,那所需空间:2*64MB*3=384MB