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

The following examples show how to use org.apache.hadoop.hdfs.DFSUtil#getNNServiceRpcAddresses() . 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: DataNode.java    From RDFS with Apache License 2.0 6 votes vote down vote up
/**
 * This method starts the data node with the specified conf.
 * 
 * @param conf - the configuration
 *  if conf's CONFIG_PROPERTY_SIMULATED property is set
 *  then a simulated storage based data node is created.
 * 
 * @param dataDirs - only for a non-simulated storage data node
 * @throws IOException
 */
void startDataNode(Configuration conf, 
                   AbstractList<File> dataDirs
                   ) throws IOException {
  initGlobalSetting(conf, dataDirs);
  
  /* Initialize namespace manager */
  List<InetSocketAddress> nameNodeAddrs = DFSUtil.getNNServiceRpcAddresses(conf);
  
  //TODO this will be no longer valid, since we will have multiple namenodes
  // We might want to keep it and assign the first NN to it.
  DataNode.nameNodeAddr = nameNodeAddrs.get(0); 
  namespaceManager = new NamespaceManager(conf, nameNodeAddrs);

  initDataSetAndScanner(conf, dataDirs, nameNodeAddrs.size());
}
 
Example 2
Source File: TestGetConf.java    From RDFS with Apache License 2.0 5 votes vote down vote up
/**
 * Using DFSUtil methods get the list of given {@code type} of address
 */
private List<InetSocketAddress> getAddressListFromConf(TestType type,
    Configuration conf) throws IOException {
  switch (type) {
  case NAMENODE:
    return DFSUtil.getNNServiceRpcAddresses(conf);
  }
  return null;
}
 
Example 3
Source File: DataNode.java    From RDFS with Apache License 2.0 5 votes vote down vote up
public void refreshNamenodes(Configuration conf) throws IOException {
  LOG.info("refresh namenodes");
  try {
    List<InetSocketAddress> nameNodeAddrs = DFSUtil.getNNServiceRpcAddresses(conf);
    namespaceManager.refreshNamenodes(nameNodeAddrs, conf);
  } catch (InterruptedException e) {
    throw new IOException(e.getCause());
  }
}