39

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.

T. Webster
  • 9,605
  • 6
  • 67
  • 94

5 Answers5

57

Use the dfsadmin command:

bin/hadoop dfsadmin -report

Update (2015):

bin/hdfs dfsadmin -report

Tejas Patil
  • 6,149
  • 1
  • 23
  • 38
  • 2
    OK what I don't get is why my namenode only reports itself as a datanode, and none of the datanodes I listed in `slaves` file show up in `dfsadmin -report` – T. Webster Jun 01 '13 at 03:45
  • On the namenode url (http://:50070/dfshealth.jsp), see if the other nodes are dead / decomissioned. Also, watch the datanode logs to identify the problem – Tejas Patil Jun 01 '13 at 03:56
  • 4
    This command is now deprecated: `DEPRECATED: Use of this script to execute hdfs command is deprecated.` – CDT Jul 31 '15 at 03:32
35

Try this:

hdfs getconf -namenodes
hdfs getconf -secondaryNamenodes
ttimasdf
  • 1,367
  • 1
  • 12
  • 19
Vishwanath
  • 359
  • 3
  • 2
26

Try This. For dfsadmin not every user has permission.

hdfs getconf -confKey fs.defaultFS
hdfs://XYZ
shashaDenovo
  • 1,638
  • 21
  • 21
5

2016 update, following Tejas answer:

hadoopuser@gsamaras:~/hadoop/bin$ ./hdfs dfsadmin -report
gsamaras
  • 71,951
  • 46
  • 188
  • 305
0
hdfs getconf -namenodes
hdfs getconf -secondaryNamenodes

Work only non-HA mode. The simplest way for HA-mode is to use:

hdfs haadmin -getAllServiceState 

haadmin work for HA mode.

Output:

hadoop-adh-1:8020                standby
hadoop-adh-2:8020                active