Tag Archives: hdfs

Listing namenodes and datanodes in Hadoop

Ever wondered how to list Hadoop namenodes? Quite easy as seen below.

user@computer:$ hdfs getconf -namenodes
hadoop02.mydomain.com hadoop01.mydomain.com

Now if you want to list the datanodes we do that with dfsadmin.

user@computer:$ hdfs dfsadmin -printTopology
Rack: /default (hadoop15.mydomain.com) (hadoop16.mydomain.com) (hadoop17.mydomain.com) (hadoop18.mydomain.com) (hadoop19.mydomain.com) (hadoop20.mydomain.com) (hadoop21.mydomain.com) (hadoop22.mydomain.com) (hadoop23.mydomain.com) (hadoop24.mydomain.com)

Above command should be executed as a user with hdfs superuser permissions.