In this blog we will be discussing about some of the Administration commands and how they work?
Hadoop fsck Commands
1. hadoop fsck /
fsck command is used to check the HDFS file system. There are different arguments that can be passed with this command to emit different results.
Please follow the below screenshot for the same.
2. hadoop fsck / -files
It displays all the files in HDFS while checking. Please refer to the below screenshot for the same.
3. hadoop fsck / -files -blocks
It displays all the blocks of the files while checking. Please refer to the below screenshot for the same.
4. hadoop fsck / -files -blocks -locations
It displays all the files block locations while checking. Please refer to the below screenshot for the same.
5. hadoop fsck / -files -blocks -locations -racks
This command is used to display the networking topology for data-node locations. Please refer to the below screenshot for the same.
6. hadoop fsck -delete
This command will delete the corrupted files in HDFS. Please refer to the below screenshot for the same.
7. hadoop fsck -move
This command is used to move the corrupted files to a particular directory, by default it will move to the /lost+found directory. Please refer to the below screens shot for the same.
Let us now discuss about the hadoop dfsadmin commands.
Hadoop dfsadmin Commands
1. hadoop dfsadmin -report
This command is used to return the file system information and its statistics. Please refer to the below screenshot for the same.
2.hadoop dfsadmin -metasave file_name.txt
This command is used to save the meta data that is present in the namenode in a file in the HDFS. Please refer to the below screenshot for the same.
Here we have given the file_name as nn.txt and it has been saved in the log directory of hdfs.
3.hadoop dfsadmin -refreshNodes
This command is used to refresh the data nodes that are allowed to connect to the name node. Please refer the below screenshot for the same.
4.hadoop fs -count -q /mydir
Checks for the quota space for the specified directory or a file. Please refer to the below screenshot for the same.
5.hadoop dfsadmin -setSpaceQuota 10M /dir_name
This command is used to set the space quota space for a particular directory. Now we will set the directory quota to 10MB and then we will check it using the command hadoop fs -count -q /mydir. Please refer to the below screenshot for the same.
In the above screenshot you can see that 10MB quota has been allocated.
6.hadoop dfsadmin -clrSpaceQuota /mydir
This command is used to clear the allocated quota to a particular directory in HDFS. Now we will clear the quota which we have previously created and check the quota again. Please refer to the below screenshot for the same.
In the above screenshot you can see that the quota has been cleared.
Hadoop Safe Mode (Maintenance Mode) Commands
Here we will discuss about Safe Mode commands:
1.hadoop dfsadmin -safemode enter
This command is used to enter safe mode. Please refer to the below screenshot for the same.
2.hadoop dfsadmin -safemode leave
This command is used to leave safe mode. Please refer to the below screenshot for the same.
3.hadoop dfsadmin -safemode get
This command is used to get the status of the safe mode. Please refer to the below screenshot for the same.
Hope this blog was informative. Click here to learn in depth about Big Data Hadoop Administration.
Feel free to contact us at support@acadgild.com for any further query.
1 Comment