From 463e093d336ff129e7b4fbe736cc3a2bb4725d39 Mon Sep 17 00:00:00 2001 From: Eric Pugh Date: Wed, 14 Aug 2024 06:28:22 -0400 Subject: [PATCH 01/19] SOLR-17359: Move Zk Arg parsing into Java Code (#2593) * Move Zk Arg parsing into Java Code from the bin/solr shell and bin/solr.cmd command scripts, making testing life easier on Windows. * Improved the output of -h to make usage information look nicer * restructure control flow so that we don't check for each script command by name and THEN call the java code, instead only look for the three exceptions, start, stop, restart. * Resolve Executing a command incorrectly gives a message which is not clear. Eg: >solr zk ls --------- Co-authored-by: Rahul Goswami --- solr/CHANGES.txt | 2 +- solr/bin/solr | 342 +----------------- solr/bin/solr.cmd | 121 +------ .../solr/cli/ConfigSetDownloadTool.java | 49 ++- .../apache/solr/cli/ConfigSetUploadTool.java | 47 ++- .../java/org/apache/solr/cli/CreateTool.java | 2 +- .../org/apache/solr/cli/LinkConfigTool.java | 5 + .../java/org/apache/solr/cli/PackageTool.java | 2 - .../src/java/org/apache/solr/cli/SolrCLI.java | 58 ++- .../src/java/org/apache/solr/cli/Tool.java | 2 +- .../org/apache/solr/cli/UpdateACLTool.java | 18 +- .../java/org/apache/solr/cli/ZkCpTool.java | 70 +++- .../java/org/apache/solr/cli/ZkLsTool.java | 17 +- .../org/apache/solr/cli/ZkMkrootTool.java | 27 +- .../java/org/apache/solr/cli/ZkMvTool.java | 41 ++- .../java/org/apache/solr/cli/ZkRmTool.java | 16 +- .../java/org/apache/solr/cli/ZkToolHelp.java | 84 +++++ .../apache/solr/cli/SolrCLIZkToolsTest.java | 309 +++------------- .../apache/solr/cli/ZkSubcommandsTest.java | 110 ++---- .../cloud_multi_node_embedded_zk/test.sh | 2 +- .../test/test_create_collection.bats | 2 +- solr/packaging/test/test_help.bats | 3 +- solr/packaging/test/test_ssl.bats | 14 +- solr/packaging/test/test_zk.bats | 29 +- .../pages/solr-control-script-reference.adoc | 4 +- .../pages/zookeeper-utilities.adoc | 2 +- .../getting-started/pages/tutorial-diy.adoc | 2 +- .../getting-started/pages/tutorial-films.adoc | 2 +- .../pages/tutorial-techproducts.adoc | 2 +- 29 files changed, 467 insertions(+), 917 deletions(-) create mode 100644 solr/core/src/java/org/apache/solr/cli/ZkToolHelp.java diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 8328743d647..1ab51dfa331 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -133,7 +133,7 @@ Dependency Upgrades Other Changes --------------------- -(No changes) +* SOLR-17359: Move Zk Arg parsing into Java Code from bin/solr scripts. (Eric Pugh, Rahul Goswami) ================== 9.7.0 ================== New Features diff --git a/solr/bin/solr b/solr/bin/solr index 7e1629724f2..e1873bce4f6 100755 --- a/solr/bin/solr +++ b/solr/bin/solr @@ -443,115 +443,9 @@ function print_usage() { echo "" echo " NOTE: To see if any Solr servers are running, do: solr status" echo "" - elif [ "$CMD" == "zk" ]; then - print_short_zk_usage "" - echo " Can be run on remote (non-Solr) hosts, as long as valid ZK_HOST information is provided" - echo " Be sure to check the Solr logs in case of errors." - echo "" - echo " -z zkHost Optional Zookeeper connection string for all commands. If specified it" - echo " overrides the 'ZK_HOST=...'' defined in solr.in.sh." - echo "" - echo " -s solrUrl Optional Solr URL to look up the correct zkHost connection string via." - echo "" - echo " -v/--verbose Enable more verbose output for this script." - echo "" - echo " upconfig uploads a configset from the local machine to Zookeeper." - echo "" - echo " downconfig downloads a configset from Zookeeper to the local machine." - echo "" - echo " -n Name of the configset in Zookeeper that will be the destination of" - echo " 'upconfig' and the source for 'downconfig'." - echo "" - echo " -d The local directory the configuration will be uploaded from for" - echo " 'upconfig' or downloaded to for 'downconfig'. If 'confdir' is a child of" - echo " ...solr/server/solr/configsets' then the configs will be copied from/to" - echo " that directory. Otherwise it is interpreted as a simple local path." - echo "" - echo " cp copies files or folders to/from Zookeeper or Zookeeper -> Zookeeper" - echo "" - echo " -r Recursively copy to . Command will fail if has children and " - echo " -r is not specified. Optional" - echo "" - echo " , : [file:][/]path/to/local/file or zk:/path/to/zk/node" - echo " NOTE: and may both be Zookeeper resources prefixed by 'zk:'" - echo " When is a zk resource, may be '.'" - echo " If ends with '/', then will be a local folder or parent znode and the last" - echo " element of the path will be appended unless also ends in a slash. " - echo " may be zk:, which may be useful when using the cp -r form to backup/restore " - echo " the entire zk state." - echo " You must enclose local paths that end in a wildcard in quotes or just" - echo " end the local path in a slash. That is," - echo " 'bin/solr zk cp -r /some/dir/ zk:/ -z localhost:2181' is equivalent to" - echo " 'bin/solr zk cp -r \"/some/dir/*\" zk:/ -z localhost:2181'" - echo " but 'bin/solr zk cp -r /some/dir/* zk:/ -z localhost:2181' will throw an error" - echo "" - echo " here's an example of backup/restore for a ZK configuration:" - echo " to copy to local: 'bin/solr zk cp -r zk:/ /some/dir -z localhost:2181'" - echo " to restore to ZK: 'bin/solr zk cp -r /some/dir/ zk:/ -z localhost:2181'" - echo "" - echo " The 'file:' prefix is stripped, thus 'file:/wherever' specifies an absolute local path and" - echo " 'file:somewhere' specifies a relative local path. All paths on Zookeeper are absolute." - echo "" - echo " Zookeeper nodes CAN have data, so moving a single file to a parent znode" - echo " will overlay the data on the parent Znode so specifying the trailing slash" - echo " can be important." - echo "" - echo " Wildcards are supported when copying from local, trailing only and must be quoted." - echo "" - echo " rm deletes files or folders on Zookeeper" - echo "" - echo " -r Recursively delete if is a directory. Command will fail if " - echo " has children and -r is not specified. Optional" - echo " : [zk:]/path/to/zk/node. may not be the root ('/')" - echo "" - echo " mv moves (renames) znodes on Zookeeper" - echo "" - echo " , : Zookeeper nodes, the 'zk:' prefix is optional." - echo " If ends with '/', then will be a parent znode" - echo " and the last element of the path will be appended." - echo " Zookeeper nodes CAN have data, so moving a single file to a parent znode" - echo " will overlay the data on the parent Znode so specifying the trailing slash" - echo " is important." - echo "" - echo " ls lists the znodes on Zookeeper" - echo "" - echo " -r Recursively descends the path listing all znodes. Optional" - echo " : The Zookeeper path to use as the root." - echo "" - echo " Only the node names are listed, not data" - echo "" - echo " mkroot makes a znode in Zookeeper with no data. Can be used to make a path of arbitrary" - echo " depth but primarily intended to create a 'chroot'." - echo "" - echo " : The Zookeeper path to create. Leading slash is assumed if not present." - echo " Intermediate nodes are created as needed if not present." - echo "" fi } # end print_usage -function print_short_zk_usage() { - - if [ "$1" != "" ]; then - echo -e "\nERROR: $1\n" - fi - - echo " Usage: solr zk upconfig|downconfig -d -n [-z zkHost] [-s solrUrl]" - echo " solr zk cp [-r] [-z zkHost] [-s solrUrl]" - echo " solr zk rm [-r] [-z zkHost] [-s solrUrl]" - echo " solr zk mv [-z zkHost] [-s solrUrl]" - echo " solr zk ls [-r] [-z zkHost] [-s solrUrl]" - echo " solr zk mkroot [-z zkHost] [-s solrUrl]" - echo " solr zk linkconfig --conf-name -c [-z zkHost] [-s solrUrl]" - echo " solr zk updateacls [-z zkHost] [-s solrUrl]" - echo "" - - if [ "$1" == "" ]; then - echo "Type bin/solr zk --help for full usage help" - else - exit 1 - fi -} - # used to show the script is still alive when waiting on work to complete function spinner() { local pid=$1 @@ -747,42 +641,6 @@ if [ "$SCRIPT_CMD" == "status" ]; then exit $? fi -# assert tool -if [ "$SCRIPT_CMD" == "assert" ]; then - run_tool assert "$@" - exit $? -fi - -# healthcheck tool -if [ "$SCRIPT_CMD" == "healthcheck" ]; then - run_tool healthcheck "$@" - exit $? -fi - -# config tool -if [ "$SCRIPT_CMD" == "config" ]; then - run_tool config "$@" - exit $? -fi - -# create a core or collection -if [[ "$SCRIPT_CMD" == "create" ]]; then - run_tool $SCRIPT_CMD $@ - exit $? -fi - -# delete a core or collection -if [[ "$SCRIPT_CMD" == "delete" ]]; then - run_tool $SCRIPT_CMD $@ - exit $? -fi - -# manage packages -if [[ "$SCRIPT_CMD" == "package" ]]; then - run_tool $SCRIPT_CMD $@ - exit $? -fi - # configure authentication if [[ "$SCRIPT_CMD" == "auth" ]]; then : "${SOLR_SERVER_DIR:=$DEFAULT_SERVER_DIR}" @@ -817,208 +675,20 @@ if [[ "$SCRIPT_CMD" == "auth" ]]; then exit $? fi -# Prevent any zk subcommands from going through with out invoking zk command -if [[ "$SCRIPT_CMD" == "upconfig" || $SCRIPT_CMD == "downconfig" || $SCRIPT_CMD == "cp" || $SCRIPT_CMD == "rm" || $SCRIPT_CMD == "mv" || $SCRIPT_CMD == "ls" || $SCRIPT_CMD == "mkroot" || $SCRIPT_CMD == "linkconfig" || $SCRIPT_CMD == "updateacls" ]]; then - print_short_zk_usage "You must invoke this subcommand using the zk command. bin/solr zk $SCRIPT_CMD." - exit $? -fi - -ZK_RECURSE=false -# Zookeeper file maintenance (upconfig, downconfig, files up/down etc.) -# It's a little clumsy to have the parsing go round and round for upconfig and downconfig, but that's -# necessary for back-compat -if [[ "$SCRIPT_CMD" == "zk" ]]; then - - VERBOSE="" - ZK_SOLR_URL="" - - if [ $# -gt 0 ]; then - while true; do - case "${1:-}" in - upconfig|downconfig|cp|rm|mv|ls|mkroot|linkconfig|updateacls) - ZK_OP=$1 - shift 1 - ;; - -z|--zk-host|-zkHost|--zkHost) - if [[ -z "$2" || "${2:0:1}" == "-" ]]; then - print_short_zk_usage "$SCRIPT_CMD" "ZooKeeper connection string is required when using the $1 option!" - fi - ZK_HOST="$2" - shift 2 - ;; - -s|--solr-url|-solrUrl) - if [[ -z "$2" || "${2:0:1}" == "-" ]]; then - print_short_zk_usage "$SCRIPT_CMD" "Solr Url is required when using the $1 option!" - fi - ZK_SOLR_URL="$2" - shift 2 - ;; - -n|--confname|--conf-name) - if [[ -z "$2" || "${2:0:1}" == "-" ]]; then - print_short_zk_usage "$SCRIPT_CMD" "Configuration name is required when using the $1 option!" - fi - CONFIGSET_CONFNAME="$2" - shift 2 - ;; - -d|--confdir|--conf-dir) - if [[ -z "$2" || "${2:0:1}" == "-" ]]; then - print_short_zk_usage "$SCRIPT_CMD" "Configuration directory is required when using the $1 option!" - fi - CONFIGSET_CONFDIR="$2" - shift 2 - ;; - --solr-home) - ZK_SOLR_HOME="$2" - shift 2 - ;; - -r) - ZK_RECURSE="true" - shift - ;; - -c|-collection) - ZK_COLLECTION="$2" - shift - ;; - -V|-verbose|--verbose) - VERBOSE="--verbose" - shift - ;; - --help|-h|-help) - print_usage "$SCRIPT_CMD" - exit 0 - ;; - --) - shift - break - ;; - *) # Pick up or params for rm, ls, cp, mv, mkroot. - if [ -z "${1:-}" ]; then - break # out-of-args, stop looping - fi - if [ -z "${ZK_SRC:-}" ]; then - ZK_SRC=$1 - else - if [ -z "${ZK_DST:-}" ]; then - ZK_DST=$1 - else - print_short_zk_usage "Unrecognized or misplaced command $1. 'cp' with trailing asterisk requires quoting, see help text." - fi - fi - shift - ;; - esac - done - fi - - if [ -z "$ZK_OP" ]; then - print_short_zk_usage "Zookeeper operation (one of 'upconfig', 'downconfig', 'rm', 'mv', 'cp', 'ls', 'mkroot', 'linkconfig', 'updateacls') is required!" - fi - - if [[ "$ZK_OP" == "upconfig" || "$ZK_OP" == "downconfig" ]]; then - if [ -z "$CONFIGSET_CONFDIR" ]; then - print_short_zk_usage "Local directory of the configset (-d) argument is required!" - fi - - if [ -z "$CONFIGSET_CONFNAME" ]; then - print_short_zk_usage "Configset name on Zookeeper (-n) argument is required!" - fi - fi - - if [[ "$ZK_OP" == "cp" || "$ZK_OP" == "mv" ]]; then - if [[ -z "$ZK_SRC" || -z "$ZK_DST" ]]; then - print_short_zk_usage " and must be specified when using either the 'mv' or 'cp' commands." - fi - if [[ "$ZK_OP" == "cp" && "${ZK_SRC:0:3}" != "zk:" && "${ZK_DST:0:3}" != "zk:" ]]; then - print_short_zk_usage "One of the source or destination paths must be prefixed by 'zk:' for the 'cp' command." - fi - fi - - if [[ "$ZK_OP" == "mkroot" ]]; then - if [[ -z "$ZK_SRC" ]]; then - print_short_zk_usage " must be specified when using the 'mkroot' command." - fi - fi - - CONNECTION_PARAMS="" - - if [[ -z "$ZK_HOST" ]]; then - if [[ -z "$ZK_SOLR_URL" ]]; then - CONNECTION_PARAMS="" - else - CONNECTION_PARAMS="--solr-url ${ZK_SOLR_URL}" - fi - - else - CONNECTION_PARAMS="--zk-host ${ZK_HOST}" - fi - - case "$ZK_OP" in - upconfig) - run_tool "$ZK_OP" --conf-name "$CONFIGSET_CONFNAME" --conf-dir "$CONFIGSET_CONFDIR" $CONNECTION_PARAMS $VERBOSE - ;; - downconfig) - run_tool "$ZK_OP" --conf-name "$CONFIGSET_CONFNAME" --conf-dir "$CONFIGSET_CONFDIR" $CONNECTION_PARAMS $VERBOSE - ;; - rm) - if [ -z "$ZK_SRC" ]; then - print_short_zk_usage "Zookeeper path to remove must be specified when using the 'rm' command" - fi - run_tool "$ZK_OP" --path "$ZK_SRC" $CONNECTION_PARAMS --recurse "$ZK_RECURSE" $VERBOSE - ;; - mv) - run_tool "$ZK_OP" --source "$ZK_SRC" --destination "$ZK_DST" $CONNECTION_PARAMS $VERBOSE - ;; - cp) - if [ -z "$ZK_SOLR_HOME" ]; then - run_tool "$ZK_OP" --source "$ZK_SRC" --destination "$ZK_DST" $CONNECTION_PARAMS --recurse "$ZK_RECURSE" $VERBOSE - else - run_tool "$ZK_OP" --source "$ZK_SRC" --destination "$ZK_DST" $CONNECTION_PARAMS --recurse "$ZK_RECURSE" $VERBOSE --solr-home "$ZK_SOLR_HOME" - fi - - ;; - ls) - if [ -z "$ZK_SRC" ]; then - print_short_zk_usage "Zookeeper path to list must be specified when using the 'ls' command" - fi - run_tool "$ZK_OP" --path "$ZK_SRC" --recurse "$ZK_RECURSE" $CONNECTION_PARAMS $VERBOSE - ;; - mkroot) - if [ -z "$ZK_SRC" ]; then - print_short_zk_usage "Zookeeper path to list must be specified when using the 'mkroot' command" - fi - run_tool "$ZK_OP" --path "$ZK_SRC" $CONNECTION_PARAMS $VERBOSE - ;; - linkconfig) - run_tool "$ZK_OP" --conf-name "$CONFIGSET_CONFNAME" -c "$ZK_COLLECTION" $CONNECTION_PARAMS $VERBOSE - ;; - updateacls) - run_tool "$ZK_OP" --path "$ZK_SRC" $CONNECTION_PARAMS $VERBOSE - ;; - *) - print_short_zk_usage "Unrecognized Zookeeper operation $ZK_OP" - ;; - esac - - exit $? -fi - -if [[ "$SCRIPT_CMD" == "api" ]]; then - run_tool api "$@" - exit $? -fi - -# verify the command given is supported -if [ "$SCRIPT_CMD" != "stop" ] && [ "$SCRIPT_CMD" != "start" ] && [ "$SCRIPT_CMD" != "restart" ] && [ "$SCRIPT_CMD" != "status" ]; then - # handoff this command to the SolrCLI and let it handle the option parsing and validation +# at this point all tools that have a custom run process, like "status" and "auth" have been run and exited. +# Unless a command is one of the ones in the if clause below, we will just run it with the default run_tool function and then exit. +if [ "$SCRIPT_CMD" != "start" ] && [ "$SCRIPT_CMD" != "stop" ] && [ "$SCRIPT_CMD" != "restart" ]; then + # hand off the command to the SolrCLI and let it handle the option parsing and validation run_tool "$SCRIPT_CMD" "$@" ret=$? if [ $ret -ne 0 ]; then - print_usage "" exit $ret fi exit 0 fi +# Everything below here is to support start, stop and restart. + #Check current Ulimits for Open Files and Max Processes. Warn if they are below the recommended values. : "${SOLR_RECOMMENDED_MAX_PROCESSES:=65000}" diff --git a/solr/bin/solr.cmd b/solr/bin/solr.cmd index 58fb4e6599e..a07b4575c7d 100755 --- a/solr/bin/solr.cmd +++ b/solr/bin/solr.cmd @@ -258,6 +258,7 @@ IF "%1"=="version" goto run_solrcli IF "%1"=="-v" goto run_solrcli IF "%1"=="-version" goto run_solrcli IF "%1"=="assert" goto run_solrcli +IF "%1"=="zk" goto run_solrcli IF "%1"=="export" goto run_solrcli IF "%1"=="package" goto run_solrcli IF "%1"=="auth" goto run_solrcli @@ -272,12 +273,7 @@ IF "%1"=="healthcheck" goto run_solrcli IF "%1"=="create" goto run_solrcli IF "%1"=="delete" goto run_solrcli IF "%1"=="postlogs" goto run_solrcli -IF "%1"=="zk" ( - set SCRIPT_CMD=zk - SHIFT - set ZK_RECURSE=false - goto parse_zk_args -) + IF "%1"=="auth" ( set SCRIPT_CMD=auth SHIFT @@ -302,7 +298,7 @@ IF "%SCRIPT_CMD%"=="healthcheck" goto run_solrcli IF "%SCRIPT_CMD%"=="create" goto run_solrcli IF "%SCRIPT_CMD%"=="delete" goto run_solrcli IF "%SCRIPT_CMD%"=="cluster" goto run_solrcli -IF "%SCRIPT_CMD%"=="zk" goto zk_usage +IF "%SCRIPT_CMD%"=="zk" goto run_solrcli IF "%SCRIPT_CMD%"=="auth" goto run_solrcli IF "%SCRIPT_CMD%"=="package" goto run_solrcli IF "%SCRIPT_CMD%"=="status" goto run_solrcli @@ -388,110 +384,6 @@ goto done @echo. goto done -:zk_usage -set ZK_FULL=true -goto zk_short_usage -:zk_full_usage -echo Can be run on remote (non-Solr^) hosts, as long as valid ZK_HOST information is provided. -echo Be sure to check the Solr logs in case of errors. -echo. -echo -z zkHost Optional Zookeeper connection string for all commands. If specified it -echo overrides the 'ZK_HOST=...'' defined in solr.in.cmd. -echo. -echo -s solrUrl Optional Solr URL to look up the correct zkHost connection string via. -echo. -echo -V Enable more verbose output. -echo. -echo upconfig uploads a configset from the local machine to Zookeeper. -echo. -echo downconfig downloads a configset from Zookeeper to the local machine. -echo. -echo -n configName Name of the configset in Zookeeper that will be the destination of -echo 'upconfig' and the source for 'downconfig'. -echo. -echo -d confdir The local directory the configuration will be uploaded from for -echo 'upconfig' or downloaded to for 'downconfig'. If 'confdir' is a child of -echo ...solr/server/solr/configsets' then the configs will be copied from/to -echo that directory. Otherwise it is interpreted as a simple local path. -echo. -echo cp copies files or folders to/from Zookeeper or Zookeeper -^> Zookeeper -echo -r Recursively copy ^ to ^. Command will fail if ^ has children and -echo -r is not specified. Optional -echo. -echo. ^, ^ : [file:][/]path/to/local/file or zk:/path/to/zk/node -echo NOTE: ^ and ^ may both be Zookeeper resources prefixed by 'zk:' -echo When ^ is a zk resource, ^ may be '.' -echo If ^ ends with '/', then ^ will be a local folder or parent znode and the last -echo element of the ^ path will be appended unless ^ also ends in a slash. -echo ^ may be zk:, which may be useful when using the cp -r form to backup/restore -echo the entire zk state. -echo You must enclose local paths that end in a wildcard in quotes or just -echo end the local path in a slash. That is, -echo 'bin/solr zk cp -r /some/dir/ zk:/ -z localhost:2181' is equivalent to -echo 'bin/solr zk cp -r ^"/some/dir/*^" zk:/ -z localhost:2181' -echo but 'bin/solr zk cp -r /some/dir/* zk:/ -z localhost:2181' will throw an error. -echo. -echo Here's an example of backup/restore for a ZK configuration: -echo to copy to local: 'bin/solr zk cp -r zk:/ /some/dir -z localhost:2181' -echo to restore to ZK: 'bin/solr zk cp -r /some/dir/ zk:/ -z localhost:2181' -echo. -echo The 'file:' prefix is stripped, thus 'file:/wherever' specifies an absolute local path and -echo 'file:somewhere' specifies a relative local path. All paths on Zookeeper are absolute. -echo. -echo Zookeeper nodes CAN have data, so moving a single file to a parent znode -echo will overlay the data on the parent Znode so specifying the trailing slash -echo can be important. -echo. -echo Wildcards are supported when copying from local, trailing only and must be quoted. -echo. -echo rm deletes files or folders on Zookeeper -echo -r Recursively delete if ^ is a directory. Command will fail if ^ -echo has children and -r is not specified. Optional -echo ^ : [zk:]/path/to/zk/node. ^ may not be the root ('/') -echo. -echo mv moves (renames) znodes on Zookeeper -echo ^, ^ : Zookeeper nodes, the 'zk:' prefix is optional. -echo If ^ ends with '/', then ^ will be a parent znode -echo and the last element of the ^ path will be appended. -echo Zookeeper nodes CAN have data, so moving a single file to a parent znode -echo will overlay the data on the parent Znode so specifying the trailing slash -echo is important. -echo. -echo ls lists the znodes on Zookeeper -echo -r recursively descends the path listing all znodes. Optional -echo ^: The Zookeeper path to use as the root. -echo. -echo Only the node names are listed, not data -echo. -echo mkroot makes a znode in Zookeeper with no data. Can be used to make a path of arbitrary -echo depth but primarily intended to create a 'chroot'. -echo. -echo ^: The Zookeeper path to create. Leading slash is assumed if not present. -echo Intermediate nodes are created as needed if not present. -echo. - -goto done - -:zk_short_usage -IF NOT "!ERROR_MSG!"=="" ( - echo ERROR: !ERROR_MSG! - echo. -) -echo Usage: solr zk upconfig^|downconfig -d ^ -n ^ [-z zkHost] [-s solrUrl] -echo solr zk cp [-r] ^ ^ [-z zkHost] [-s solrUrl] -echo solr zk rm [-r] ^ [-z zkHost] [-s solrUrl] -echo solr zk mv ^ ^ [-z zkHost] [-s solrUrl] -echo solr zk ls [-r] ^ [-z zkHost] [-s solrUrl] -echo solr zk mkroot ^ [-z zkHost] [-s solrUrl] -echo solr zk linkconfig --conf-name ^ -c ^ [-z zkHost] [-s solrUrl] -echo solr zk updateacls ^ [-z zkHost] [-s solrUrl] -echo. -IF "%ZK_FULL%"=="true" ( - goto zk_full_usage -) ELSE ( - echo Type bin/solr zk --help for full usage help -) -goto done REM Really basic command-line arg parsing :parse_args @@ -512,6 +404,7 @@ IF "%1"=="-v" goto set_debug IF "%1"=="-q" goto set_warn IF "%1"=="-c" goto set_cloud_mode IF "%1"=="-cloud" goto set_cloud_mode +IF "%1"=="--cloud" goto set_cloud_mode IF "%1"=="-d" goto set_server_dir IF "%1"=="--dir" goto set_server_dir IF "%1"=="-s" goto set_solr_home_dir @@ -1411,12 +1304,6 @@ IF "%1"=="-V" ( goto set_collection_zk ) ELSE IF "%1"=="-z" ( goto set_config_zk -) ELSE IF "%1"=="/?" ( - goto zk_usage -) ELSE IF "%1"=="-h" ( - goto zk_usage -) ELSE IF "%1"=="-help" ( - goto zk_usage ) ELSE IF "!ZK_SRC!"=="" ( if not "%~1"=="" ( goto set_zk_src diff --git a/solr/core/src/java/org/apache/solr/cli/ConfigSetDownloadTool.java b/solr/core/src/java/org/apache/solr/cli/ConfigSetDownloadTool.java index 87ca00c1705..d9322485dc7 100644 --- a/solr/core/src/java/org/apache/solr/cli/ConfigSetDownloadTool.java +++ b/solr/core/src/java/org/apache/solr/cli/ConfigSetDownloadTool.java @@ -23,6 +23,7 @@ import java.nio.file.Paths; import java.util.List; import org.apache.commons.cli.CommandLine; +import org.apache.commons.cli.DeprecatedAttributes; import org.apache.commons.cli.Option; import org.apache.solr.common.cloud.SolrZkClient; import org.slf4j.Logger; @@ -43,18 +44,44 @@ public ConfigSetDownloadTool(PrintStream stdout) { @Override public List