Java Code Examples for org.apache.hadoop.hdfs.DFSConfigKeys#DFS_DATANODE_HTTP_DEFAULT_PORT

The following examples show how to use org.apache.hadoop.hdfs.DFSConfigKeys#DFS_DATANODE_HTTP_DEFAULT_PORT . 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: NNThroughputBenchmark.java    From hadoop with Apache License 2.0 6 votes vote down vote up
void register() throws IOException {
  // get versions from the namenode
  nsInfo = nameNodeProto.versionRequest();
  dnRegistration = new DatanodeRegistration(
      new DatanodeID(DNS.getDefaultIP("default"),
          DNS.getDefaultHost("default", "default"),
          DataNode.generateUuid(), getNodePort(dnIdx),
          DFSConfigKeys.DFS_DATANODE_HTTP_DEFAULT_PORT,
          DFSConfigKeys.DFS_DATANODE_HTTPS_DEFAULT_PORT,
          DFSConfigKeys.DFS_DATANODE_IPC_DEFAULT_PORT),
      new DataStorage(nsInfo),
      new ExportedBlockKeys(), VersionInfo.getVersion());
  // register datanode
  dnRegistration = nameNodeProto.registerDatanode(dnRegistration);
  //first block reports
  storage = new DatanodeStorage(DatanodeStorage.generateUuid());
  final StorageBlockReport[] reports = {
      new StorageBlockReport(storage, BlockListAsLongs.EMPTY)
  };
  nameNodeProto.blockReport(dnRegistration, 
      nameNode.getNamesystem().getBlockPoolId(), reports,
          new BlockReportContext(1, 0, System.nanoTime()));
}
 
Example 2
Source File: NNThroughputBenchmark.java    From big-c with Apache License 2.0 6 votes vote down vote up
void register() throws IOException {
  // get versions from the namenode
  nsInfo = nameNodeProto.versionRequest();
  dnRegistration = new DatanodeRegistration(
      new DatanodeID(DNS.getDefaultIP("default"),
          DNS.getDefaultHost("default", "default"),
          DataNode.generateUuid(), getNodePort(dnIdx),
          DFSConfigKeys.DFS_DATANODE_HTTP_DEFAULT_PORT,
          DFSConfigKeys.DFS_DATANODE_HTTPS_DEFAULT_PORT,
          DFSConfigKeys.DFS_DATANODE_IPC_DEFAULT_PORT),
      new DataStorage(nsInfo),
      new ExportedBlockKeys(), VersionInfo.getVersion());
  // register datanode
  dnRegistration = nameNodeProto.registerDatanode(dnRegistration);
  //first block reports
  storage = new DatanodeStorage(DatanodeStorage.generateUuid());
  final StorageBlockReport[] reports = {
      new StorageBlockReport(storage, BlockListAsLongs.EMPTY)
  };
  nameNodeProto.blockReport(dnRegistration, 
      nameNode.getNamesystem().getBlockPoolId(), reports,
          new BlockReportContext(1, 0, System.nanoTime()));
}
 
Example 3
Source File: DatanodeManager.java    From hadoop with Apache License 2.0 5 votes vote down vote up
/**
 * Parse a DatanodeID from a hosts file entry
 * @param hostLine of form [hostname|ip][:port]?
 * @return DatanodeID constructed from the given string
 */
private DatanodeID parseDNFromHostsEntry(String hostLine) {
  DatanodeID dnId;
  String hostStr;
  int port;
  int idx = hostLine.indexOf(':');

  if (-1 == idx) {
    hostStr = hostLine;
    port = DFSConfigKeys.DFS_DATANODE_DEFAULT_PORT;
  } else {
    hostStr = hostLine.substring(0, idx);
    port = Integer.parseInt(hostLine.substring(idx+1));
  }

  if (InetAddresses.isInetAddress(hostStr)) {
    // The IP:port is sufficient for listing in a report
    dnId = new DatanodeID(hostStr, "", "", port,
        DFSConfigKeys.DFS_DATANODE_HTTP_DEFAULT_PORT,
        DFSConfigKeys.DFS_DATANODE_HTTPS_DEFAULT_PORT,
        DFSConfigKeys.DFS_DATANODE_IPC_DEFAULT_PORT);
  } else {
    String ipAddr = "";
    try {
      ipAddr = InetAddress.getByName(hostStr).getHostAddress();
    } catch (UnknownHostException e) {
      LOG.warn("Invalid hostname " + hostStr + " in hosts file");
    }
    dnId = new DatanodeID(ipAddr, hostStr, "", port,
        DFSConfigKeys.DFS_DATANODE_HTTP_DEFAULT_PORT,
        DFSConfigKeys.DFS_DATANODE_HTTPS_DEFAULT_PORT,
        DFSConfigKeys.DFS_DATANODE_IPC_DEFAULT_PORT);
  }
  return dnId;
}
 
Example 4
Source File: DatanodeManager.java    From big-c with Apache License 2.0 5 votes vote down vote up
/**
 * Parse a DatanodeID from a hosts file entry
 * @param hostLine of form [hostname|ip][:port]?
 * @return DatanodeID constructed from the given string
 */
private DatanodeID parseDNFromHostsEntry(String hostLine) {
  DatanodeID dnId;
  String hostStr;
  int port;
  int idx = hostLine.indexOf(':');

  if (-1 == idx) {
    hostStr = hostLine;
    port = DFSConfigKeys.DFS_DATANODE_DEFAULT_PORT;
  } else {
    hostStr = hostLine.substring(0, idx);
    port = Integer.parseInt(hostLine.substring(idx+1));
  }

  if (InetAddresses.isInetAddress(hostStr)) {
    // The IP:port is sufficient for listing in a report
    dnId = new DatanodeID(hostStr, "", "", port,
        DFSConfigKeys.DFS_DATANODE_HTTP_DEFAULT_PORT,
        DFSConfigKeys.DFS_DATANODE_HTTPS_DEFAULT_PORT,
        DFSConfigKeys.DFS_DATANODE_IPC_DEFAULT_PORT);
  } else {
    String ipAddr = "";
    try {
      ipAddr = InetAddress.getByName(hostStr).getHostAddress();
    } catch (UnknownHostException e) {
      LOG.warn("Invalid hostname " + hostStr + " in hosts file");
    }
    dnId = new DatanodeID(ipAddr, hostStr, "", port,
        DFSConfigKeys.DFS_DATANODE_HTTP_DEFAULT_PORT,
        DFSConfigKeys.DFS_DATANODE_HTTPS_DEFAULT_PORT,
        DFSConfigKeys.DFS_DATANODE_IPC_DEFAULT_PORT);
  }
  return dnId;
}