Hadoop Admin Commands

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.

2

3. hadoop fsck / -files -blocks

It displays all the blocks of the files while checking. Please refer to the below screenshot for the same.

3

4. hadoop fsck / -files -blocks -locations

It displays all the files block locations while checking. Please refer to the below screenshot for the same.

4

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.

5

 

6. hadoop fsck -delete

This command will delete the corrupted files in HDFS. Please refer to the below screenshot for the same.

6

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.

7

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.

8

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.

9

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.

10

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.

11

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.

12

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.

13

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 -safe mode enter

This command is used to enter safe mode. Please refer to the below screenshot for the same.

13

2.hadoop dfsadmin -safemode leave

This command is used to leave safe mode. Please refer to the below screenshot for the same.

143.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.

15

Hope this blog was informative

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s