Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List the namenode and datanodes of a cluster from any node?

From any node in a Hadoop cluster, what is the command to

  • identify the running namenode?
  • identify all running datanodes?

I have looked through the commands manual and have not found this.

like image 831
T. Webster Avatar asked Jun 01 '13 03:06

T. Webster


People also ask

What are Namenodes and DataNodes?

HDFS separates files into blocks, which are then stored on DataNodes. The NameNode, the cluster's master node, is connected to several DataNodes. These data blocks are replicated across the cluster by the master node. It also tells the user where to get the information they're looking for.

How many Namenodes and DataNodes exist in a HDFS system?

An HDFS cluster consists of a single NameNode, a master server that manages the file system namespace and regulates access to files by clients. In addition, there are a number of DataNodes, usually one per node in the cluster, which manage storage attached to the nodes that they run on.

What is NameNode in Hadoop cluster?

NameNode is the master node in the Apache Hadoop HDFS Architecture that maintains and manages the blocks present on the DataNodes (slave nodes). NameNode is a very highly available server that manages the File System Namespace and controls access to files by clients.


Video Answer


4 Answers

Use the dfsadmin command:

bin/hadoop dfsadmin -report

Update (2015):

bin/hdfs dfsadmin -report

like image 197
Tejas Patil Avatar answered Oct 22 '22 20:10

Tejas Patil


Try this:

hdfs getconf -namenodes
hdfs getconf -secondaryNamenodes
like image 39
Vishwanath Avatar answered Oct 22 '22 19:10

Vishwanath


Try This. For dfsadmin not every user has permission.

hdfs getconf -confKey fs.defaultFS
hdfs://XYZ
like image 30
shashaDenovo Avatar answered Oct 22 '22 19:10

shashaDenovo


2016 update, following Tejas answer:

hadoopuser@gsamaras:~/hadoop/bin$ ./hdfs dfsadmin -report
like image 29
gsamaras Avatar answered Oct 22 '22 18:10

gsamaras