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


Java StartupOption.FORMAT属性代码示例

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


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

示例1: createArgs

private static String[] createArgs(StartupOption operation) {
  if (operation == StartupOption.ROLLINGUPGRADE) {
    return new String[]{operation.getName(),
        operation.getRollingUpgradeStartupOption().name()};
  }
  String[] args = (operation == null ||
      operation == StartupOption.FORMAT ||
      operation == StartupOption.REGULAR) ?
          new String[] {} : new String[] {operation.getName()};
  return args;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:11,代码来源:MiniDFSCluster.java

示例2: parseArguments

/**
 * Parses arguments and fills out the member variables.
 *
 * @param args
 *          Command-line arguments.
 * @return true on successful parse; false to indicate that the program should
 *         exit.
 */
private boolean parseArguments(String[] args) {
  Options options = makeOptions();
  CommandLine cli;
  try {
    CommandLineParser parser = new GnuParser();
    cli = parser.parse(options, args);
  } catch (ParseException e) {
    LOG.warn("options parsing failed:  " + e.getMessage());
    new HelpFormatter().printHelp("...", options);
    return false;
  }

  if (cli.hasOption("help")) {
    new HelpFormatter().printHelp("...", options);
    return false;
  }
  if (cli.getArgs().length > 0) {
    for (String arg : cli.getArgs()) {
      System.err.println("Unrecognized option: " + arg);
      new HelpFormatter().printHelp("...", options);
      return false;
    }
  }

  // MR
  noMR = cli.hasOption("nomr");
  numNodeManagers = intArgument(cli, "nodemanagers", 1);
  rmPort = intArgument(cli, "rmport", 0);
  jhsPort = intArgument(cli, "jhsport", 0);
  fs = cli.getOptionValue("namenode");

  // HDFS
  noDFS = cli.hasOption("nodfs");
  numDataNodes = intArgument(cli, "datanodes", 1);
  nnPort = intArgument(cli, "nnport", 0);
  dfsOpts = cli.hasOption("format") ? StartupOption.FORMAT
      : StartupOption.REGULAR;

  // Runner
  writeDetails = cli.getOptionValue("writeDetails");
  writeConfig = cli.getOptionValue("writeConfig");

  // General
  conf = new JobConf();
  updateConfiguration(conf, cli.getOptionValues("D"));

  return true;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:56,代码来源:MiniHadoopClusterManager.java

示例3: loadFSImage

private void loadFSImage(StartupOption startOpt) throws IOException {
  final FSImage fsImage = getFSImage();

  // format before starting up if requested
  if (startOpt == StartupOption.FORMAT) {
    
    fsImage.format(this, fsImage.getStorage().determineClusterId());// reuse current id

    startOpt = StartupOption.REGULAR;
  }
  boolean success = false;
  writeLock();
  try {
    // We shouldn't be calling saveNamespace if we've come up in standby state.
    MetaRecoveryContext recovery = startOpt.createRecoveryContext();
    final boolean staleImage
        = fsImage.recoverTransitionRead(startOpt, this, recovery);
    if (RollingUpgradeStartupOption.ROLLBACK.matches(startOpt) ||
        RollingUpgradeStartupOption.DOWNGRADE.matches(startOpt)) {
      rollingUpgradeInfo = null;
    }
    final boolean needToSave = staleImage && !haEnabled && !isRollingUpgrade(); 
    LOG.info("Need to save fs image? " + needToSave
        + " (staleImage=" + staleImage + ", haEnabled=" + haEnabled
        + ", isRollingUpgrade=" + isRollingUpgrade() + ")");
    if (needToSave) {
      fsImage.saveNamespace(this);
    } else {
      updateStorageVersionForRollingUpgrade(fsImage.getLayoutVersion(),
          startOpt);
      // No need to save, so mark the phase done.
      StartupProgress prog = NameNode.getStartupProgress();
      prog.beginPhase(Phase.SAVING_CHECKPOINT);
      prog.endPhase(Phase.SAVING_CHECKPOINT);
    }
    // This will start a new log segment and write to the seen_txid file, so
    // we shouldn't do it when coming up in standby state
    if (!haEnabled || (haEnabled && startOpt == StartupOption.UPGRADE)
        || (haEnabled && startOpt == StartupOption.UPGRADEONLY)) {
      fsImage.openEditLogForWrite();
    }
    success = true;
  } finally {
    if (!success) {
      fsImage.close();
    }
    writeUnlock();
  }
  imageLoadComplete();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:50,代码来源:FSNamesystem.java

示例4: parseArguments

/**
 * Parses arguments and fills out the member variables.
 * @param args Command-line arguments.
 * @return true on successful parse; false to indicate that the
 * program should exit.
 */
private boolean parseArguments(String[] args) {
  Options options = makeOptions();
  CommandLine cli;
  try {
    CommandLineParser parser = new GnuParser();
    cli = parser.parse(options, args);
  } catch(ParseException e) {
    LOG.warn("options parsing failed:  "+e.getMessage());
    new HelpFormatter().printHelp("...", options);
    return false;
  }

  if (cli.hasOption("help")) {
    new HelpFormatter().printHelp("...", options);
    return false;
  }
  
  if (cli.getArgs().length > 0) {
    for (String arg : cli.getArgs()) {
      LOG.error("Unrecognized option: " + arg);
      new HelpFormatter().printHelp("...", options);
      return false;
    }
  }

  // HDFS
  numDataNodes = intArgument(cli, "datanodes", 1);
  nameNodePort = intArgument(cli, "nnport", 0);
  if (cli.hasOption("format")) {
    dfsOpts = StartupOption.FORMAT;
    format = true;
  } else {
    dfsOpts = StartupOption.REGULAR;
    format = false;
  }

  // Runner
  writeDetails = cli.getOptionValue("writeDetails");
  writeConfig = cli.getOptionValue("writeConfig");

  // General
  conf = new HdfsConfiguration();
  updateConfiguration(conf, cli.getOptionValues("D"));

  return true;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:52,代码来源:MiniDFSClusterManager.java


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