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

5

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.

Alston answered 1/6, 2013 at 3:33 Comment(1)
List of datanodes is available via namenode's JMX interface -- https://mcmap.net/q/409002/-rest-api-for-getting-dfs-used-for-individual-nodes-in-hadoop/1097572Wingspan
F
57

Use the dfsadmin command:

bin/hadoop dfsadmin -report

Update (2015):

bin/hdfs dfsadmin -report

Foeman answered 1/6, 2013 at 3:40 Comment(3)
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 -reportAlston
On the namenode url (http://<IP of namenode>:50070/dfshealth.jsp), see if the other nodes are dead / decomissioned. Also, watch the datanode logs to identify the problemFoeman
This command is now deprecated: DEPRECATED: Use of this script to execute hdfs command is deprecated.Coppinger
M
35

Try this:

hdfs getconf -namenodes
hdfs getconf -secondaryNamenodes
Motionless answered 22/3, 2016 at 14:19 Comment(0)
P
26

Try This. For dfsadmin not every user has permission.

hdfs getconf -confKey fs.defaultFS
hdfs://XYZ
Pneumatophore answered 19/10, 2016 at 17:8 Comment(0)
O
5

2016 update, following Tejas answer:

hadoopuser@gsamaras:~/hadoop/bin$ ./hdfs dfsadmin -report
Ox answered 24/1, 2016 at 14:7 Comment(0)
E
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
Enzymology answered 5/7, 2023 at 7:38 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.