Skip to content
Permalink
Browse files

0003520: Symadmin should have an option to unregister a node

  • Loading branch information...
philipmarzullo
philipmarzullo committed Jan 21, 2019
1 parent bd1f715 commit 0dcde64e0d5cb89744b77e288b784c695398d23b
@@ -99,6 +99,8 @@
private static final String CMD_EXPORT_SYM_TABLES = "export-sym-tables";

private static final String CMD_OPEN_REGISTRATION = "open-registration";

private static final String CMD_REMOVE_NODE = "remove-node";

private static final String CMD_SYNC_TRIGGERS = "sync-triggers";

@@ -178,6 +180,7 @@ protected void printHelp(CommandLine line, Options options) {
PrintWriter pw = new PrintWriter(System.out);
printHelpLine(pw, CMD_LIST_ENGINES);
printHelpLine(pw, CMD_OPEN_REGISTRATION);
printHelpLine(pw, CMD_REMOVE_NODE);
printHelpLine(pw, CMD_RELOAD_NODE);
printHelpLine(pw, CMD_RELOAD_TABLE);
printHelpLine(pw, CMD_EXPORT_BATCH);
@@ -240,12 +243,15 @@ private void printHelpCommand(CommandLine line) {
if (cmd.equals(CMD_RELOAD_NODE)) {
addOption(options, "r", OPTION_REVERSE, false);
}
if (cmd.equals(CMD_REMOVE_NODE)) {
addOption(options, "n", OPTION_NODE, true);
}

if (options.getOptions().size() > 0) {
format.printWrapped(writer, WIDTH, "\nOptions:");
format.printOptions(writer, WIDTH, options, PAD, PAD);
}

if (!ArrayUtils.contains(NO_ENGINE_REQUIRED, cmd)) {
format.printWrapped(writer, WIDTH, "\nEngine options:");
options = new Options();
@@ -305,6 +311,9 @@ protected boolean executeWithOptions(CommandLine line) throws Exception {
} else if (cmd.equals(CMD_OPEN_REGISTRATION)) {
openRegistration(line, args);
return true;
} else if(cmd.equals(CMD_REMOVE_NODE)) {
removeNode(line, args);
return true;
} else if (cmd.equals(CMD_RELOAD_NODE)) {
reloadNode(line, args);
return true;
@@ -468,6 +477,12 @@ private void openRegistration(CommandLine line, List<String> args) {
"Opened registration for node group of '%s' external ID of '%s'", nodeGroupId,
externalId));
}

private void removeNode(CommandLine line, List<String> args) {
String node = line.getOptionValue(OPTION_NODE);
getSymmetricEngine().removeAndCleanupNode(node);
System.out.println(String.format("Removed node '%s' from engine '%s'", node, getSymmetricEngine().getEngineName()));
}

private void reloadNode(CommandLine line, List<String> args) {
String nodeId = popArg(args, "Node ID");
@@ -65,6 +65,7 @@ SymAdmin.Cmd.create-war=Create web archive for deployment
SymAdmin.Cmd.create-sym-tables=Create tables required by SymmetricDS
SymAdmin.Cmd.export-sym-tables=Export tables required by SymmetricDS
SymAdmin.Cmd.open-registration=Open registration for a node
SymAdmin.Cmd.remove-node=Remove specified node (unregister and clean up) for the provided engine
SymAdmin.Cmd.sync-triggers=Create database triggers
SymAdmin.Cmd.drop-triggers=Drop database triggers
SymAdmin.Cmd.export-properties=Export default properties
@@ -85,6 +86,7 @@ SymAdmin.Usage.create-war=<filename>
SymAdmin.Usage.create-sym-tables=
SymAdmin.Usage.export-sym-tables=<filename>
SymAdmin.Usage.open-registration=<node group> <external id>
SymAdmin.Usage.remove-node=<node-id>
SymAdmin.Usage.sync-triggers=[<tablename> ...]
SymAdmin.Usage.drop-triggers=[<tablename> ...]
SymAdmin.Usage.export-properties=[<filename>]
@@ -99,6 +101,7 @@ SymAdmin.Help.run-purge=Run the purge process against the configured database.
SymAdmin.Help.export-properties=Export all properties with their default values, along with comments describing them. If a filename is given, the properties are written to it, otherwise standard output is used.
SymAdmin.Help.create-sym-tables=Attempts to create the symmetric tables in the configured database.
SymAdmin.Help.open-registration=Open registration for the passed in node group and external id.
SymAdmin.Help.remove-node=Remove specified node (unregister and clean up) for the specified engine
SymAdmin.Help.export-batch=Export the batch CSV data for the given batch ID. If a filename is given, the data is written to file, otherwise it uses standard output.
SymAdmin.Help.import-batch=Import the batch CSV data from the specified file into the database. If a filename is given, the batch data is read from it, otherwise standard input is used.
SymAdmin.Help.sync-triggers=Run the sync triggers process to create database triggers that are missing or re-create database triggers that have a configuration change. If a filename is specified, the SQL statements are also written to file. If triggers should not be applied automatically then set the auto.sync.triggers property to false.

0 comments on commit 0dcde64

Please sign in to comment.
You can’t perform that action at this time.