use of joptsimple.OptionParser in project voldemort by voldemort.
the class RepartitionerCLI method setupParser.
private static void setupParser() {
parser = new OptionParser();
parser.accepts("help", "Print usage information");
parser.accepts("current-cluster", "Path to current cluster xml").withRequiredArg().describedAs("cluster.xml");
parser.accepts("interim-cluster", "Path to interim cluster xml").withRequiredArg().describedAs("cluster.xml");
parser.accepts("current-stores", "Path to current store definition xml. Needed for cluster and zone expansion.").withRequiredArg().describedAs("stores.xml");
parser.accepts("final-stores", "Path to final store definition xml. Needed for zone expansion. Used with interim-cluster.").withRequiredArg().describedAs("stores.xml");
parser.accepts("attempts", "Number of attempts at repartitioning. [ Default: " + Repartitioner.DEFAULT_REPARTITION_ATTEMPTS + " ]").withRequiredArg().ofType(Integer.class).describedAs("num-attempts");
parser.accepts("output-dir", "Specify the output directory for the repartitioned cluster.xml and the analysis files.").withRequiredArg().ofType(String.class).describedAs("path");
parser.accepts("disable-node-balancing", "Make sure that all nodes within every zone have the same (within one) number of primary partitions [default: enabled]");
parser.accepts("disable-zone-balancing", "Make sure that all zones have the same (within one) number of primary partitions [default: enabled]");
parser.accepts("enable-random-swaps", "Enable attempts to improve balance by random partition swaps within a zone. [Default: disabled]");
parser.accepts("random-swap-attempts", "Number of random swaps to attempt. [Default:" + Repartitioner.DEFAULT_RANDOM_SWAP_ATTEMPTS + " ]").withRequiredArg().ofType(Integer.class).describedAs("num-attempts");
parser.accepts("random-swap-successes", "Number of successful random swaps to permit exit before completing all swap attempts. [Default:" + Repartitioner.DEFAULT_RANDOM_SWAP_SUCCESSES + " ]").withRequiredArg().ofType(Integer.class).describedAs("num-successes");
parser.accepts("random-swap-zoneids", "Comma separated zone ids that you want to shuffle. [Default:Shuffle all zones.]").withRequiredArg().describedAs("random-zoneids-to-shuffle").withValuesSeparatedBy(',').ofType(Integer.class);
parser.accepts("enable-greedy-swaps", "Enable attempts to improve balance by greedily swapping (random) partitions within a zone. [Default: disabled]");
parser.accepts("greedy-swap-attempts", "Number of greedy (random) swaps to attempt. [Default:" + Repartitioner.DEFAULT_GREEDY_SWAP_ATTEMPTS + " ]").withRequiredArg().ofType(Integer.class).describedAs("num-attempts");
parser.accepts("greedy-max-partitions-per-node", "Max number of partitions per-node to evaluate swapping with other partitions within the zone. [Default:" + Repartitioner.DEFAULT_GREEDY_MAX_PARTITIONS_PER_NODE + " ]").withRequiredArg().ofType(Integer.class).describedAs("max-partitions-per-node");
parser.accepts("greedy-max-partitions-per-zone", "Max number of (random) partitions per-zone to evaluate swapping with partitions from node being evaluated. [Default:" + Repartitioner.DEFAULT_GREEDY_MAX_PARTITIONS_PER_ZONE + " ]").withRequiredArg().ofType(Integer.class).describedAs("max-partitions-per-zone");
parser.accepts("greedy-swap-zoneids", "Comma separated zone ids that you want to shuffle. [Default: Shuffle each zone.]").withRequiredArg().describedAs("greedy-zoneids-to-shuffle").withValuesSeparatedBy(',').ofType(Integer.class);
parser.accepts("max-contiguous-partitions", "Limit the number of contiguous partition IDs allowed within a zone. [Default:" + Repartitioner.DEFAULT_MAX_CONTIGUOUS_PARTITIONS + " (indicating no limit)]").withRequiredArg().ofType(Integer.class).describedAs("num-contiguous");
}
use of joptsimple.OptionParser in project voldemort by voldemort.
the class ReplaceNodeCLI method main.
public static void main(String[] args) throws Exception {
OptionParser parser = null;
OptionSet options = null;
try {
parser = getParser();
options = parser.parse(args);
} catch (OptionException oe) {
parser.printHelpOn(System.out);
printUsageAndDie("Exception when parsing arguments : " + oe.getMessage());
return;
}
/* validate options */
if (options.hasArgument("help")) {
parser.printHelpOn(System.out);
printUsage();
return;
}
if (!options.hasArgument("url") || !options.hasArgument("node") || !options.hasArgument("newurl")) {
parser.printHelpOn(System.out);
printUsageAndDie("Missing a required argument.");
return;
}
String url = (String) options.valueOf("url");
String newUrl = (String) options.valueOf("newurl");
int nodeId = ((Integer) options.valueOf("node")).intValue();
boolean skipRestore = options.has("skip-restore");
int parallelism = ((Integer) options.valueOf("parallelism")).intValue();
if (parallelism <= 0) {
Utils.croak(" parallelism " + parallelism + " should be a positive integer ");
}
ReplaceNodeCLI nodeReplacer = new ReplaceNodeCLI(url, nodeId, newUrl, skipRestore, parallelism);
try {
nodeReplacer.execute();
} catch (VoldemortApplicationException e) {
logger.error("Error during node replace", e);
Utils.croak(e.getMessage());
}
}
use of joptsimple.OptionParser in project voldemort by voldemort.
the class GenerateScriptCLI method setupParser.
private static OptionParser setupParser() {
OptionParser parser = new OptionParser();
parser.accepts("help", "Print usage information").withOptionalArg();
parser.acceptsAll(Arrays.asList("s", "script"), "Script").withRequiredArg().describedAs("script").ofType(String.class);
parser.acceptsAll(Arrays.asList("u", "url"), "bootstrapUrl").withRequiredArg().describedAs("url").ofType(String.class);
parser.acceptsAll(Arrays.asList("scp", "scpFile"), "file to be scp ed").withRequiredArg().describedAs("scp").ofType(String.class);
parser.acceptsAll(Arrays.asList("o", "output"), "outputScript").withRequiredArg().describedAs("output").ofType(String.class);
return parser;
}
use of joptsimple.OptionParser in project voldemort by voldemort.
the class KeyVersionFetcherCLI method getParser.
/**
* Return args parser
*
* @return program parser
* */
private static OptionParser getParser() {
OptionParser parser = new OptionParser();
parser.accepts("help", "print help information");
parser.accepts("url", "[REQUIRED] bootstrap URL").withRequiredArg().describedAs("bootstrap-url").ofType(String.class);
parser.accepts("in-dir", "[REQUIRED] Directory in which to find the input key files (named \"{storeName}.kvs\", generated by KeyFetcherCLI.").withRequiredArg().describedAs("inputDirectory").ofType(String.class);
parser.accepts("out-dir", "[REQUIRED] Directory in which to output the key files (named \"{storeName}.kvs\".").withRequiredArg().describedAs("outputDirectory").ofType(String.class);
parser.accepts("store-names", "Store names to sample. Comma delimited list or singleton. [Default: ALL]").withRequiredArg().describedAs("storeNames").withValuesSeparatedBy(',').ofType(String.class);
parser.accepts("parallelism", "Number of key-versions to sample in parallel. [Default: " + DEFAULT_KEY_PARALLELISM + " ]").withRequiredArg().describedAs("storeParallelism").ofType(Integer.class);
parser.accepts("progress-period-ops", "Number of operations between progress info is displayed. [Default: " + DEFAULT_PROGRESS_PERIOD_OPS + " ]").withRequiredArg().describedAs("progressPeriodOps").ofType(Integer.class);
parser.accepts("output-batch-size", "Number of keys fetched and written out in sorted order at once. [Default: " + DEFAULT_OUTPUT_BATCH_SIZE + " ]").withRequiredArg().describedAs("outputBatchSize").ofType(Integer.class);
parser.accepts("details", "print details of each key-version: partition ID, node ID, & hostname");
return parser;
}
use of joptsimple.OptionParser in project voldemort by voldemort.
the class DeleteKeysCLI method setupParser.
private static OptionParser setupParser() {
OptionParser parser = new OptionParser();
parser.accepts("help", "Print usage information").withOptionalArg();
parser.accepts("url", "bootstrapUrl").withRequiredArg().describedAs("bootstrap url");
parser.accepts("zone", "Zone id").withRequiredArg().describedAs("zone id").ofType(Integer.class).defaultsTo(-1);
parser.accepts("stores", "store").withRequiredArg().describedAs("stores to delete the key/value from").withValuesSeparatedBy(',').ofType(String.class);
parser.accepts("keyfile", "key file").withRequiredArg().describedAs("file with keys to be deleted are stored as one per line");
parser.accepts("qps", "keys to be deleted per store").withRequiredArg().describedAs("number of operations allowed per second per store").ofType(Integer.class).defaultsTo(100);
parser.accepts("delete-all-versions", "Deletes all versions for a given key").withOptionalArg();
parser.accepts("nodeid", "Delete keys if it is hosted in a node").withRequiredArg().describedAs("Delete keys belonging to a node").ofType(Integer.class).defaultsTo(-1);
parser.accepts("admin-url", "admin url").withRequiredArg().describedAs("admin url");
parser.accepts("check-keys-exist", "Verify if the number of keys exist").withRequiredArg().describedAs("Check if the given number of keys exist in the store").ofType(Integer.class).defaultsTo(100);
return parser;
}
Aggregations