利用java查看hdfs/hadoop系统的状态与配置
/**Name : KcnaufHadoopManagement
*Author : Zhang Bing
*Created : 2013-7-31
*Function : Catch the hadoop status of filesystem
*
*/
package com.exercise.hadoop.command;
import java.io.IOException;
import java.security.AccessControlException;
import java.util.Iterator;
import java.util.Map.Entry;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.hdfs.DistributedFileSystem;
import org.apache.hadoop.hdfs.protocol.DatanodeInfo;
public class HadoopStatus {
public static Configuration config;
/**
*config the Configuration
*/
static{
config=new Configuration();
}
/**
*get the information of datanode
* @return
* @throws AccessControlException
*/
public String[] getDataNodeReport() throws AccessControlException{
try{
FileSystem hdfSystem = FileSystem.get(config);
DistributedFileSystem hdfs = (DistributedFileSyst