Example usage for org.apache.hadoop.hdfs DistributedFileSystem getDataNodeStats

List of usage examples for org.apache.hadoop.hdfs DistributedFileSystem getDataNodeStats

Introduction

In this page you can find the example usage for org.apache.hadoop.hdfs DistributedFileSystem getDataNodeStats.

Prototype

public DatanodeInfo[] getDataNodeStats() throws IOException 

Source Link

Usage

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

}