Java Code Examples for org.apache.hadoop.hdfs.server.common.HdfsServerConstants.StartupOption#FORMAT

The following examples show how to use org.apache.hadoop.hdfs.server.common.HdfsServerConstants.StartupOption#FORMAT . 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: MiniDFSCluster.java    From hadoop with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 2
Source File: MiniDFSCluster.java    From big-c with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 3
Source File: MiniHadoopClusterManager.java    From hadoop with Apache License 2.0 4 votes vote down vote up
/**
 * 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;
}
 
Example 4
Source File: MiniDFSClusterManager.java    From hadoop with Apache License 2.0 4 votes vote down vote up
/**
 * 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;
}
 
Example 5
Source File: MiniHadoopClusterManager.java    From big-c with Apache License 2.0 4 votes vote down vote up
/**
 * 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;
}
 
Example 6
Source File: MiniDFSClusterManager.java    From big-c with Apache License 2.0 4 votes vote down vote up
/**
 * 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;
}