I have access to a data node in a Hadoop cluster, and I'd like to find out the identity of the name nodes for the same cluster. Is there a way to do this?
Asked
Active
Viewed 6,389 times
2 Answers
1
You can read the configuration file of the datanode, specifically hdfs-site.xml
. It will list the namenode that the datanode will try to connect to.
1
use below script
#!/bin/bash
date >> list_of_datanodes
bin/hadoop dfsadmin -report > dfsstat.txt
cat dfsstat.txt |grep 'Datanodes available' --color >> list_of_datanodes
cat dfsstat.txt |grep 'Name:' --color >> list_of_datanodes
rm -rf dfsstat.txt
chicks
- 3,639
- 10
- 26
- 36
Sujit Kadam
- 11
- 1
-
1Recursively deleting the `dfsstat.txt` files seems like overkill. – chicks Jun 08 '16 at 13:14