当前位置: 首页>>代码示例>>Java>>正文


Java FSConstants.DFS_NAMENODE_RPC_ADDRESS_KEY属性代码示例

本文整理汇总了Java中org.apache.hadoop.hdfs.protocol.FSConstants.DFS_NAMENODE_RPC_ADDRESS_KEY属性的典型用法代码示例。如果您正苦于以下问题:Java FSConstants.DFS_NAMENODE_RPC_ADDRESS_KEY属性的具体用法?Java FSConstants.DFS_NAMENODE_RPC_ADDRESS_KEY怎么用?Java FSConstants.DFS_NAMENODE_RPC_ADDRESS_KEY使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.hadoop.hdfs.protocol.FSConstants的用法示例。


在下文中一共展示了FSConstants.DFS_NAMENODE_RPC_ADDRESS_KEY属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getNNServiceRpcAddresses

/**
 * Returns list of InetSocketAddresses corresponding to namenodes from the
 * configuration. Note this is to be used by datanodes to get the list of
 * namenode addresses to talk to.
 * 
 * Returns namenode address specifically configured for datanodes (using
 * service ports), if found. If not, regular RPC address configured for other
 * clients is returned.
 * 
 * @param conf configuration
 * @return list of InetSocketAddress
 * @throws IOException on error
 */
public static List<InetSocketAddress> getNNServiceRpcAddresses(
    Configuration conf) throws IOException {
  // Use default address as fall back
  String defaultAddress;
  try {
    defaultAddress = NameNode.getDefaultAddress(conf);
  } catch (IllegalArgumentException e) {
    defaultAddress = null;
  }
  
  List<InetSocketAddress> addressList = getAddresses(conf, defaultAddress,
      NameNode.DATANODE_PROTOCOL_ADDRESS, FSConstants.DFS_NAMENODE_RPC_ADDRESS_KEY);
  if (addressList == null) {
    throw new IOException("Incorrect configuration: namenode address "
        + NameNode.DATANODE_PROTOCOL_ADDRESS + " or "  
        + FSConstants.DFS_NAMENODE_RPC_ADDRESS_KEY
        + " is not configured.");
  }
  return addressList;
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:33,代码来源:DFSUtil.java

示例2: translateToOldSchema

/** Translates nameserviceId to ZK key in deprecated layout */
@Deprecated
public static URI translateToOldSchema(Configuration clusterConf, String nameserviceId) {
  String key = FSConstants.DFS_NAMENODE_RPC_ADDRESS_KEY + "." + nameserviceId;
  String value = clusterConf.get(key);
  if (value == null) {
    throw new IllegalArgumentException(
        "Cannot translate to old schema for nameserviceId: " + nameserviceId);
  }
  InetSocketAddress address = NetUtils.createSocketAddr(value);
  return NameNode.getUri(address);
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:12,代码来源:StorageServiceConfigKeys.java

示例3: getClientRpcAddresses

/**
 * Returns list of InetSocketAddresses corresponding to namenodes from the
 * configuration. Note this is to be used by clients to get the list of
 * namenode addresses to talk to.
 * 
 * Returns namenode address specifically configured for clients (using
 * service ports)
 * 
 * @param conf configuration
 * @return list of InetSocketAddress
 * @throws IOException on error
 */
public static List<InetSocketAddress> getClientRpcAddresses(
    Configuration conf, Collection<String> suffixes) throws IOException {

  List<InetSocketAddress> addressList; 
  if(suffixes != null && !suffixes.isEmpty()){
    addressList = new ArrayList<InetSocketAddress>();
    for (String s : suffixes) {
      addressList.addAll(getRPCAddresses(s, conf, getNameServiceIds(conf),
          FSConstants.DFS_NAMENODE_RPC_ADDRESS_KEY));
    }
  } else {
    // Use default address as fall back
    String defaultAddress;
    try {
      defaultAddress = NameNode.getDefaultAddress(conf);
    } catch (IllegalArgumentException e) {
      defaultAddress = null;
    }
    addressList = getAddresses(conf, defaultAddress,
      FSConstants.DFS_NAMENODE_RPC_ADDRESS_KEY);
  }
  if (addressList == null || addressList.isEmpty()) {
    throw new IOException("Incorrect configuration: namenode address "
        + FSConstants.DFS_NAMENODE_RPC_ADDRESS_KEY
        + " is not configured.");
  }
  return addressList;
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:40,代码来源:DFSUtil.java


注:本文中的org.apache.hadoop.hdfs.protocol.FSConstants.DFS_NAMENODE_RPC_ADDRESS_KEY属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。