Java Code Examples for org.apache.hadoop.hdfs.DFSUtil#getInfoServer()

The following examples show how to use org.apache.hadoop.hdfs.DFSUtil#getInfoServer() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClusterJspHelper.java    From RDFS with Apache License 2.0 6 votes vote down vote up
public NamenodeStatus getNamenodeStatus()
    throws IOException, MalformedObjectNameException {
  NamenodeStatus nn = new NamenodeStatus();
  nn.address = this.address;
  nn.filesAndDirectories = mxbeanProxy.getTotalFiles();
  nn.capacity = mxbeanProxy.getTotal();
  nn.free = mxbeanProxy.getFree();
  nn.nsUsed = mxbeanProxy.getNamespaceUsed();
  nn.nonDfsUsed = mxbeanProxy.getNonDfsUsedSpace();
  nn.blocksCount = mxbeanProxy.getTotalBlocks();
  nn.missingBlocksCount = mxbeanProxy.getNumberOfMissingBlocks();
  nn.httpAddress = DFSUtil.getInfoServer(rpcAddress, conf, isAvatar);
  nn.safeModeText = mxbeanProxy.getSafeModeText();
  getLiveNodeCount(mxbeanProxy.getLiveNodes(), nn);
  getDeadNodeCount(mxbeanProxy.getDeadNodes(), nn);
  nn.namenodeSpecificInfo = mxbeanProxy.getNNSpecificKeys();
  if (nn.namenodeSpecificInfo == null) {
    throw new IOException("Namenode SpecificInfo is null");
  }
  nn.isPrimary = mxbeanProxy.getIsPrimary();
  return nn;
}
 
Example 2
Source File: DFSck.java    From hadoop with Apache License 2.0 5 votes vote down vote up
/**
 * Derive the namenode http address from the current file system,
 * either default or as set by "-fs" in the generic options.
 * @return Returns http address or null if failure.
 * @throws IOException if we can't determine the active NN address
 */
private URI getCurrentNamenodeAddress(Path target) throws IOException {
  //String nnAddress = null;
  Configuration conf = getConf();

  //get the filesystem object to verify it is an HDFS system
  final FileSystem fs = target.getFileSystem(conf);
  if (!(fs instanceof DistributedFileSystem)) {
    System.err.println("FileSystem is " + fs.getUri());
    return null;
  }

  return DFSUtil.getInfoServer(HAUtil.getAddressOfActive(fs), conf,
      DFSUtil.getHttpClientScheme(conf));
}
 
Example 3
Source File: DFSck.java    From big-c with Apache License 2.0 5 votes vote down vote up
/**
 * Derive the namenode http address from the current file system,
 * either default or as set by "-fs" in the generic options.
 * @return Returns http address or null if failure.
 * @throws IOException if we can't determine the active NN address
 */
private URI getCurrentNamenodeAddress(Path target) throws IOException {
  //String nnAddress = null;
  Configuration conf = getConf();

  //get the filesystem object to verify it is an HDFS system
  final FileSystem fs = target.getFileSystem(conf);
  if (!(fs instanceof DistributedFileSystem)) {
    System.err.println("FileSystem is " + fs.getUri());
    return null;
  }

  return DFSUtil.getInfoServer(HAUtil.getAddressOfActive(fs), conf,
      DFSUtil.getHttpClientScheme(conf));
}
 
Example 4
Source File: ClusterJspHelper.java    From RDFS with Apache License 2.0 5 votes vote down vote up
NameNodeMXBeanObject(InetSocketAddress namenode, Configuration conf)
  throws IOException, URISyntaxException {
  httpAddress = DFSUtil.getInfoServer(namenode, conf, isAvatar);
  InetSocketAddress infoSocAddr = NetUtils.createSocketAddr(httpAddress);
  String nameNodeMXBeanContent = DFSUtil.getHTMLContent(
      new URI("http", null, infoSocAddr.getHostName(), 
          infoSocAddr.getPort(), "/namenodeMXBean", null, null));
  TypeReference<Map<String, Object>> type = 
      new TypeReference<Map<String, Object>>() { };
  values = mapper.readValue(nameNodeMXBeanContent, type);
}
 
Example 5
Source File: ClusterJspHelper.java    From hadoop with Apache License 2.0 4 votes vote down vote up
NamenodeMXBeanHelper(InetSocketAddress addr, Configuration conf)
    throws IOException, MalformedObjectNameException {
  this.host = addr.getHostName();
  this.httpAddress = DFSUtil.getInfoServer(addr, conf,
      DFSUtil.getHttpClientScheme(conf));
}
 
Example 6
Source File: ClusterJspHelper.java    From big-c with Apache License 2.0 4 votes vote down vote up
NamenodeMXBeanHelper(InetSocketAddress addr, Configuration conf)
    throws IOException, MalformedObjectNameException {
  this.host = addr.getHostName();
  this.httpAddress = DFSUtil.getInfoServer(addr, conf,
      DFSUtil.getHttpClientScheme(conf));
}