in server/base/src/main/java/org/apache/accumulo/server/util/Admin.java [434:576]
public void execute(final String[] args) {
ServerUtilOpts opts = new ServerUtilOpts();
JCommander cl = new JCommander(opts);
cl.setProgramName("accumulo admin");
ServiceStatusCmdOpts serviceStatusCommandOpts = new ServiceStatusCmdOpts();
cl.addCommand("serviceStatus", serviceStatusCommandOpts);
ChangeSecretCommand changeSecretCommand = new ChangeSecretCommand();
cl.addCommand("changeSecret", changeSecretCommand);
CheckCommand checkCommand = new CheckCommand();
cl.addCommand("check", checkCommand);
DeleteZooInstanceCommand deleteZooInstOpts = new DeleteZooInstanceCommand();
cl.addCommand("deleteZooInstance", deleteZooInstOpts);
DumpConfigCommand dumpConfigCommand = new DumpConfigCommand();
cl.addCommand("dumpConfig", dumpConfigCommand);
FateOpsCommand fateOpsCommand = new FateOpsCommand();
cl.addCommand("fate", fateOpsCommand);
GracefulShutdownCommand gracefulShutdownCommand = new GracefulShutdownCommand();
cl.addCommand("signalShutdown", gracefulShutdownCommand);
ListInstancesCommand listInstancesOpts = new ListInstancesCommand();
cl.addCommand("listInstances", listInstancesOpts);
TabletServerLocksCommand tServerLocksOpts = new TabletServerLocksCommand();
cl.addCommand("locks", tServerLocksOpts);
PingCommand pingCommand = new PingCommand();
cl.addCommand("ping", pingCommand);
RestoreZooCommand restoreZooOpts = new RestoreZooCommand();
cl.addCommand("restoreZoo", restoreZooOpts);
StopCommand stopOpts = new StopCommand();
cl.addCommand("stop", stopOpts);
StopAllCommand stopAllOpts = new StopAllCommand();
cl.addCommand("stopAll", stopAllOpts);
StopManagerCommand stopManagerOpts = new StopManagerCommand();
cl.addCommand("stopManager", stopManagerOpts);
VerifyTabletAssignmentsCommand verifyTabletAssignmentsOpts =
new VerifyTabletAssignmentsCommand();
cl.addCommand("verifyTabletAssigns", verifyTabletAssignmentsOpts);
VolumesCommand volumesCommand = new VolumesCommand();
cl.addCommand("volumes", volumesCommand);
cl.parse(args);
if (cl.getParsedCommand() == null) {
cl.usage();
return;
}
for (var command : cl.getCommands().entrySet()) {
var objects = command.getValue().getObjects();
for (var obj : objects) {
if (obj instanceof SubCommandOpts && ((SubCommandOpts) obj).help) {
command.getValue().usage();
return;
}
}
}
try (ServerContext context = opts.getServerContext()) {
AccumuloConfiguration conf = context.getConfiguration();
// Login as the server on secure HDFS
if (conf.getBoolean(Property.INSTANCE_RPC_SASL_ENABLED)) {
SecurityUtil.serverLogin(conf);
}
int rc = 0;
if (cl.getParsedCommand().equals("listInstances")) {
ListInstances.listInstances(context.getZooKeepers(), listInstancesOpts.printAll,
listInstancesOpts.printErrors);
} else if (cl.getParsedCommand().equals("ping")) {
if (ping(context, pingCommand.args) != 0) {
rc = 4;
}
} else if (cl.getParsedCommand().equals("stop")) {
stopTabletServer(context, stopOpts.args, stopOpts.force);
} else if (cl.getParsedCommand().equals("signalShutdown")) {
signalGracefulShutdown(context, gracefulShutdownCommand.address);
} else if (cl.getParsedCommand().equals("dumpConfig")) {
printConfig(context, dumpConfigCommand);
} else if (cl.getParsedCommand().equals("volumes")) {
ListVolumesUsed.listVolumes(context);
} else if (cl.getParsedCommand().equals("verifyTabletAssigns")) {
VerifyTabletAssignments.execute(opts.getClientProps(), verifyTabletAssignmentsOpts.verbose);
} else if (cl.getParsedCommand().equals("changeSecret")) {
ChangeSecret.execute(context, conf);
} else if (cl.getParsedCommand().equals("deleteZooInstance")) {
DeleteZooInstance.execute(context, deleteZooInstOpts.clean, deleteZooInstOpts.instance,
deleteZooInstOpts.auth);
} else if (cl.getParsedCommand().equals("restoreZoo")) {
RestoreZookeeper.execute(conf, restoreZooOpts.file, restoreZooOpts.overwrite);
} else if (cl.getParsedCommand().equals("locks")) {
TabletServerLocks.execute(context, args.length > 2 ? args[2] : null,
tServerLocksOpts.delete);
} else if (cl.getParsedCommand().equals("fate")) {
executeFateOpsCommand(context, fateOpsCommand);
} else if (cl.getParsedCommand().equals("serviceStatus")) {
ServiceStatusCmd ssc = new ServiceStatusCmd();
ssc.execute(context, serviceStatusCommandOpts.json, serviceStatusCommandOpts.noHosts);
} else if (cl.getParsedCommand().equals("check")) {
executeCheckCommand(context, checkCommand, opts);
} else if (cl.getParsedCommand().equals("stopManager")
|| cl.getParsedCommand().equals("stopAll")) {
boolean everything = cl.getParsedCommand().equals("stopAll");
if (everything) {
flushAll(context);
}
stopServer(context, everything);
} else {
cl.usage();
}
if (rc != 0) {
System.exit(rc);
}
} catch (AccumuloException e) {
log.error("{}", e.getMessage(), e);
System.exit(1);
} catch (AccumuloSecurityException e) {
log.error("{}", e.getMessage(), e);
System.exit(2);
} catch (Exception e) {
log.error("{}", e.getMessage(), e);
System.exit(3);
}
}