List of usage examples for org.apache.hadoop.hdfs DistributedFileSystem getDataNodeStats
public DatanodeInfo[] getDataNodeStats() throws IOException
From source file:com.bigdog.hadoop.hdfs.HDFS_Test.java
public static void getHDFSNode() throws IOException { Configuration conf = new Configuration(); FileSystem fs = FileSystem.get(conf); DistributedFileSystem dfs = (DistributedFileSystem) fs; DatanodeInfo[] dataNodeStats = dfs.getDataNodeStats(); for (int i = 0; i < dataNodeStats.length; i++) { System.out.println("DataNode_" + i + "_Node:" + dataNodeStats[i].getHostName()); }// w w w . j a va 2 s . com }