In a multiuser environment, quota can enforce the fair share of computing resources. HDFS supports quota for users and directories. In this recipe, we will list steps to configure the HDFS quota.
We assume that the Hadoop cluster has been configured properly and all the daemons are running without any issues.
Perform the following steps to manage an HDFS quota:
Set the name quota on the home directory with the following command:
hadoop dfsadmin -setQuota 20 /usr/hduser
This command will set name quota on the home directory to 20, which means at most 20 files, including directories, can be created under the home directory.
If we reach the quota, an error message similar to the following will be given:
put: org.apache.hadoop.hdfs.protocol.NSQuotaExceededException: The NameSpace quota (directories and files) of directory /user/hduser is exceeded: quota=20 file count=141
Set the space quota of the current user's home directory to be
100000000...