Apache Solr open-source search software
SOLR-16824: Adopt Linux Command line tool pattern of -- for long option commands (#1768)
Eric Pugh0df3e63ffbdc
diff --git a/dev-docs/FAQ.adoc b/dev-docs/FAQ.adocindex 230fd0f1e41..b25d81bd6a9 100644--- a/dev-docs/FAQ.adoc+++ b/dev-docs/FAQ.adoc@@ -26,7 +26,7 @@ You can review instructions for running Solr in Docker in the xref:running-in-do=== Whats the fastest build lifecycle for frontend work on Solr Admin?Run `gradle dev`, and then `cd ./packaging/build/dev/`. Fire up your cluster-via `bin/solr start -e cloud -noprompt` and then as you make changes to assets in `/solr/webapp/web`,+via `bin/solr start -e cloud --no-prompt` and then as you make changes to assets in `/solr/webapp/web`,run `gradle dev` to redeploy the web assets. Do a hard refresh in your browserto pick up your changes.@@ -97,4 +97,3 @@ If you don't yet have an account, you have to ask for one in the 'users' or 'dev* http://fucit.org/solr-jenkins-reports/failure-report.html* https://ge.apache.org/scans/tests?search.relativeStartTime=P90D&search.rootProjectNames=solr** https://lists.apache.org[Solr mailing list archives especially builds]-diff --git a/dev-tools/scripts/cloud.sh b/dev-tools/scripts/cloud.shindex 6f4f4bb548b..3ab979d5ac3 100755--- a/dev-tools/scripts/cloud.sh+++ b/dev-tools/scripts/cloud.sh@@ -352,7 +352,7 @@ stop() {SOLR=${CLUSTER_WD}/$(find . -maxdepth 1 -name 'solr*' -type d -print0 | xargs -0 ls -1 -td | sed -E 's/\.\/(solr.*)/\1/' | head -n1)popd- "${SOLR}/bin/solr" stop -all+ "${SOLR}/bin/solr" stop --all}########################diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 6c89c9867ee..400a7925684 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -135,6 +135,10 @@ Improvements* SOLR-15591: Make using debugger in Solr easier by avoiding NPE in ExternalPaths.determineSourceHome. (@charlygrappa via Eric Pugh)+* SOLR-16824: Adopt Linux standard pattern of -- for long option commands, and make all commands "kebab" formatting. I.e -zkHost is now -zk-host. The old parameters+ such as -zkHost continue to be supported in the 9.x line of Solr. -u is now used to specify user credentials everywhere, this only impacts the bin/solr assert+ commands "same user" check which has -u as the short form of --same-user. (Eric Pugh, janhoy, Jason Gerlowski)+Optimizations---------------------* SOLR-17257: Both Minimize Cores and the Affinity replica placement strategies would over-gatherdiff --git a/solr/bin/solr b/solr/bin/solrindex a2b9445604c..ac6c4330b79 100755--- a/solr/bin/solr+++ b/solr/bin/solr@@ -17,7 +17,7 @@# CONTROLLING STARTUP:#-# Use solr -help to see available command-line options. In addition+# Use solr --help to see available command-line options. In addition# to passing command-line options, this script looks for an include# file named solr.in.sh to set environment variables. Specifically,# the following locations are searched in this order:@@ -367,30 +367,30 @@ function print_usage() {if [[ "$CMD" == "start" || "$CMD" == "restart" ]]; thenecho ""- echo "Usage: solr $CMD [-f] [-c] [-h hostname] [-p port] [-d directory] [-z zkHost] [-m memory] [-e example] [-s solr.solr.home] [-t solr.data.home] [-a \"additional-options\"] [-V]"+ echo "Usage: solr $CMD [-f] [-c] [--host host] [-p port] [-d directory] [-z zkHost] [-m memory] [-e example] [-s solr.solr.home] [-t solr.data.home] [-a \"additional-options\"] [-V]"echo ""echo " -f Start Solr in foreground; default starts Solr in the background"echo " and sends stdout / stderr to solr-PORT-console.log"echo ""- echo " -c or -cloud Start Solr in SolrCloud mode; if -z not supplied and ZK_HOST not defined in"+ echo " -c or --cloud Start Solr in SolrCloud mode; if -z not supplied and ZK_HOST not defined in"echo " solr.in.sh, an embedded ZooKeeper instance is started on Solr port+1000,"echo " such as 9983 if Solr is bound to 8983"echo ""- echo " -host <host> Specify the hostname for this Solr instance"+ echo " --host <host> Specify the hostname for this Solr instance"echo ""- echo " -p <port> Specify the port to start the Solr HTTP listener on; default is 8983"+ echo " -p/--port <port> Specify the port to start the Solr HTTP listener on; default is 8983"echo " The specified port (SOLR_PORT) will also be used to determine the stop port"echo " STOP_PORT=(\$SOLR_PORT-1000) and JMX RMI listen port RMI_PORT=(\$SOLR_PORT+10000). "echo " For instance, if you set -p 8985, then the STOP_PORT=7985 and RMI_PORT=18985"echo ""echo " -d <dir> Specify the Solr server directory; defaults to server"echo ""- echo " -z/-zkHost <zkHost> Zookeeper connection string; only used when running in SolrCloud mode using -c"+ echo " -z/--zk-host <zkHost> Zookeeper connection string; only used when running in SolrCloud mode using -c"echo " If neither ZK_HOST is defined in solr.in.sh nor the -z parameter is specified,"echo " an embedded ZooKeeper instance will be launched."echo " Set the ZK_CREATE_CHROOT environment variable to true if your ZK host has a chroot path, and you want to create it automatically."echo ""- echo " -m <memory> Sets the min (-Xms) and max (-Xmx) heap size for the JVM, such as: -m 4g"+ echo " -m/--memory <memory> Sets the min (-Xms) and max (-Xmx) heap size for the JVM, such as: -m 4g"echo " results in: -Xms4g -Xmx4g; by default, this script sets the heap size to 512m"echo ""echo " -s <dir> Sets the solr.solr.home system property; Solr will create core directories under"@@ -401,7 +401,7 @@ function print_usage() {echo " on which example is run. The default value is server/solr. If passed relative dir,"echo " validation with current dir will be done, before trying default server/<dir>"echo ""- echo " -t <dir> Sets the solr.data.home system property, where Solr will store index data in <instance_dir>/data subdirectories."+ echo " -t/--data-home <dir> Sets the solr.data.home system property, where Solr will store index data in <instance_dir>/data subdirectories."echo " If not set, Solr uses solr.solr.home for config and data."echo ""echo " -e <example> Name of the example to run; available examples:"@@ -420,14 +420,14 @@ function print_usage() {echo " you could pass: -j \"--include-jetty-dir=/etc/jetty/custom/server/\""echo " In most cases, you should wrap the additional parameters in double quotes."echo ""- echo " -noprompt Don't prompt for input; accept all defaults when running examples that accept user input"+ echo " --no-prompt Don't prompt for input; accept all defaults when running examples that accept user input"echo ""- echo " -force If attempting to start Solr as the root user, the script will exit with a warning that running Solr as \"root\" can cause problems."- echo " It is possible to override this warning with the '-force' parameter."+ echo " --force If attempting to start Solr as the root user, the script will exit with a warning that running Solr as \"root\" can cause problems."+ echo " It is possible to override this warning with the '--force' parameter."echo ""echo " -v and -q Verbose (-v) or quiet (-q) logging. Sets default log level of Solr to DEBUG or WARN instead of INFO"echo ""- echo " -V/-verbose Verbose messages from this script"+ echo " -V/--verbose Verbose messages from this script"echo ""elif [ "$CMD" == "stop" ]; thenecho ""@@ -437,9 +437,9 @@ function print_usage() {echo ""echo " -p <port> Specify the port the Solr HTTP listener is bound to"echo ""- echo " -all Find and stop all running Solr servers on this host"+ echo " --all Find and stop all running Solr servers on this host"echo ""- echo " -V/-verbose Verbose messages from this script"+ echo " -V/--verbose Verbose messages from this script"echo ""echo " NOTE: To see if any Solr servers are running, do: solr status"echo ""@@ -453,7 +453,7 @@ function print_usage() {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 " -v/--verbose Enable more verbose output for this script."echo ""echo " upconfig uploads a configset from the local machine to Zookeeper."echo ""@@ -528,21 +528,21 @@ function print_usage() {echo ""elif [ "$CMD" == "auth" ]; thenecho ""- echo "Usage: solr auth enable [-type basicAuth] -credentials user:pass [-blockUnknown <true|false>] [-updateIncludeFileOnly <true|false>] [-V]"- echo " solr auth enable [-type basicAuth] -prompt <true|false> [-blockUnknown <true|false>] [-updateIncludeFileOnly <true|false>] [-V]"- echo " solr auth enable -type kerberos -config \"<kerberos configs>\" [-updateIncludeFileOnly <true|false>] [-V]"- echo " solr auth disable [-updateIncludeFileOnly <true|false>] [-V]"+ echo "Usage: solr auth enable [--type basicAuth] --credentials user:pass [--block-unknown <true|false>] [--update-include-file-only <true|false>] [-v]"+ echo " solr auth enable [--type basicAuth] --prompt <true|false> [--block-unknown <true|false>] [--update-include-file-only <true|false>] [-v]"+ echo " solr auth enable --type kerberos --config \"<kerberos configs>\" [--update-include-file-only <true|false>] [-v]"+ echo " solr auth disable [--update-include-file-only <true|false>] [-v]"echo ""echo " Updates or enables/disables authentication. Must be run on the machine hosting Solr."echo ""- echo " -type or -t <type> The authentication mechanism (basicAuth or kerberos) to enable. Defaults to 'basicAuth'."+ echo " --type or -t <type> The authentication mechanism (basicAuth or kerberos) to enable. Defaults to 'basicAuth'."echo ""- echo " -credentials <user:pass> The username and password of the initial user. Applicable for basicAuth only."- echo " Note: only one of -prompt or -credentials must be provided"+ echo " --credentials <user:pass> The username and password of the initial user. Applicable for basicAuth only."+ echo " Note: only one of --prompt or --credentials must be provided"echo ""- echo " -config \"<configs>\" Configuration parameters (Solr startup parameters). Required and applicable only for Kerberos"+ echo " --config \"<configs>\" Configuration parameters (Solr startup parameters). Required and applicable only for Kerberos"echo ""- echo " -solrIncludeFile <includeFilePath> Specify the full path to the include file in the environment."+ echo " --solr-include-file <includeFilePath> Specify the full path to the include file in the environment."echo " If not specified this script looks for an include file named solr.in.sh to set environment variables. "echo " Specifically,the following locations are searched in this order:"echo " <script location>/."@@ -553,25 +553,25 @@ function print_usage() {echo " /var/solr"echo " /opt/solr"echo ""- echo " -prompt <true|false> Prompts the user to provide the credentials. Applicable for basicAuth only."- echo " Note: only one of -prompt or -credentials must be provided"+ echo " --prompt <true|false> Prompts the user to provide the credentials. Applicable for basicAuth only."+ echo " Note: only one of --prompt or --credentials must be provided"echo ""- echo " -blockUnknown <true|false> When true, this blocks out access to unauthenticated users. When not provided,"+ echo " --block-unknown <true|false> When true, this blocks out access to unauthenticated users. When not provided,"echo " this defaults to false (i.e. unauthenticated users can access all endpoints, except the"echo " operations like collection-edit, security-edit, core-admin-edit etc.). Check the reference"echo " guide for Basic Authentication for more details. Applicable for basicAuth only."echo ""- echo " -updateIncludeFileOnly <true|false> Only update the solr.in.sh or solr.in.cmd file, and skip actual enabling/disabling"+ echo " --update-include-file-only <true|false> Only update the solr.in.sh or solr.in.cmd file, and skip actual enabling/disabling"echo " authentication (i.e. don't update security.json)"echo ""- echo " -z or -zkHost <zkHost> Zookeeper connection string. Unnecessary if ZK_HOST is defined in solr.in.sh."+ echo " -z or --zk-host <zkHost> Zookeeper connection string. Unnecessary if ZK_HOST is defined in solr.in.sh."echo ""- echo " -d or -dir <dir> Specify the Solr server directory"+ echo " -d or --dir <dir> Specify the Solr server directory"echo ""- echo " -s or -solr.home <dir> Specify the Solr home directory. This is where any credentials or authentication"+ echo " -s or --solr-home <dir> Specify the Solr home directory. This is where any credentials or authentication"echo " configuration files (e.g. basicAuth.conf) would be placed."echo ""- echo " -V/-verbose Enable more verbose output for this script."+ echo " -v/--verbose Enable more verbose output for this script."echo ""elif [ "$CMD" == "package" ]; thenecho ""@@ -591,12 +591,12 @@ function print_short_zk_usage() {echo " solr zk mv <src> <dest> [-z zkHost] [-s solrUrl]"echo " solr zk ls [-r] <path> [-z zkHost] [-s solrUrl]"echo " solr zk mkroot <path> [-z zkHost] [-s solrUrl]"- echo " solr zk linkconfig -confname <confname> -c <collection> [-z zkHost] [-s solrUrl]"+ echo " solr zk linkconfig --conf-name <confname> -c <collection> [-z zkHost] [-s solrUrl]"echo " solr zk updateacls <path> [-z zkHost] [-s solrUrl]"echo ""if [ "$1" == "" ]; then- echo "Type bin/solr zk -help for full usage help"+ echo "Type bin/solr zk --help for full usage help"elseexit 1fi@@ -671,7 +671,7 @@ function get_status() {port=$(jetty_port "$ID")if [ "$port" != "" ]; thenecho -e "\nSolr process $ID running on port $port"- run_tool status -solrUrl "$SOLR_URL_SCHEME://$SOLR_TOOL_HOST:$port/solr" "$@"+ run_tool status --solr-url "$SOLR_URL_SCHEME://$SOLR_TOOL_HOST:$port" "$@"echo ""elseecho -e "\nSolr process $ID from $PIDF not found."@@ -689,7 +689,7 @@ function get_status() {if [ "$port" != "" ]; thenecho ""echo "Solr process $ID running on port $port"- run_tool status -solrUrl "$SOLR_URL_SCHEME://$SOLR_TOOL_HOST:$port/solr" "$@"+ run_tool status --solr-url "$SOLR_URL_SCHEME://$SOLR_TOOL_HOST:$port" "$@"echo ""fidone@@ -747,7 +747,7 @@ function run_package() {fifi- run_tool package -solrUrl "$runningSolrUrl" "$@"+ run_tool package --solr-url "$runningSolrUrl" "$@"#exit $?}@@ -825,7 +825,7 @@ function stop_solr() {if [ $# -eq 1 ]; thencase $1 in- -help|-h)+ --help|-h|-help)run_tool ""exit;;@@ -899,28 +899,28 @@ if [[ "$SCRIPT_CMD" == "zk" ]]; thenZK_OP=$1shift 1;;- -z|-zkhost|-zkHost)+ -z|--zk-host|-zkHost|--zkHost)if [[ -z "$2" || "${2:0:1}" == "-" ]]; thenprint_short_zk_usage "$SCRIPT_CMD" "ZooKeeper connection string is required when using the $1 option!"fiZK_HOST="$2"shift 2;;- -s|-solrUrl)+ -s|--solr-url|-solrUrl)if [[ -z "$2" || "${2:0:1}" == "-" ]]; thenprint_short_zk_usage "$SCRIPT_CMD" "Solr Url is required when using the $1 option!"fiZK_SOLR_URL="$2"shift 2;;- -n|--confname)+ -n|--confname|--conf-name)if [[ -z "$2" || "${2:0:1}" == "-" ]]; thenprint_short_zk_usage "$SCRIPT_CMD" "Configuration name is required when using the $1 option!"fiCONFIGSET_CONFNAME="$2"shift 2;;- -d|--confdir)+ -d|--confdir|--conf-dir)if [[ -z "$2" || "${2:0:1}" == "-" ]]; thenprint_short_zk_usage "$SCRIPT_CMD" "Configuration directory is required when using the $1 option!"fi@@ -939,11 +939,11 @@ if [[ "$SCRIPT_CMD" == "zk" ]]; thenZK_COLLECTION="$2"shift;;- -V|-verbose)- VERBOSE="-verbose"+ -V|-verbose|--verbose)+ VERBOSE="--verbose"shift;;- -help|-h)+ --help|-h|-help)print_usage "$SCRIPT_CMD"exit 0;;@@ -1002,32 +1002,37 @@ if [[ "$SCRIPT_CMD" == "zk" ]]; thenCONNECTION_PARAMS=""if [[ -z "$ZK_HOST" ]]; then- CONNECTION_PARAMS="-solrUrl ${ZK_SOLR_URL}"+ if [[ -z "$ZK_SOLR_URL" ]]; then+ CONNECTION_PARAMS=""+ else+ CONNECTION_PARAMS="--solr-url ${ZK_SOLR_URL}"+ fi+else- CONNECTION_PARAMS="-zkHost ${ZK_HOST}"+ CONNECTION_PARAMS="--zk-host ${ZK_HOST}"ficase "$ZK_OP" inupconfig)- run_tool "$ZK_OP" --confname "$CONFIGSET_CONFNAME" -confdir "$CONFIGSET_CONFDIR" $CONNECTION_PARAMS -configsetsDir "$SOLR_TIP/server/solr/configsets" $VERBOSE+ run_tool "$ZK_OP" --conf-name "$CONFIGSET_CONFNAME" --conf-dir "$CONFIGSET_CONFDIR" $CONNECTION_PARAMS $VERBOSE;;downconfig)- run_tool "$ZK_OP" --confname "$CONFIGSET_CONFNAME" -confdir "$CONFIGSET_CONFDIR" $CONNECTION_PARAMS $VERBOSE+ run_tool "$ZK_OP" --conf-name "$CONFIGSET_CONFNAME" --conf-dir "$CONFIGSET_CONFDIR" $CONNECTION_PARAMS $VERBOSE;;rm)if [ -z "$ZK_SRC" ]; thenprint_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+ run_tool "$ZK_OP" --path "$ZK_SRC" $CONNECTION_PARAMS --recurse "$ZK_RECURSE" $VERBOSE;;mv)- run_tool "$ZK_OP" -src "$ZK_SRC" -dst "$ZK_DST" $CONNECTION_PARAMS $VERBOSE+ run_tool "$ZK_OP" --source "$ZK_SRC" --destination "$ZK_DST" $CONNECTION_PARAMS $VERBOSE;;cp)if [ -z "$ZK_SOLR_HOME" ]; then- run_tool "$ZK_OP" -src "$ZK_SRC" -dst "$ZK_DST" $CONNECTION_PARAMS -recurse "$ZK_RECURSE" $VERBOSE+ run_tool "$ZK_OP" --source "$ZK_SRC" --destination "$ZK_DST" $CONNECTION_PARAMS --recurse "$ZK_RECURSE" $VERBOSEelse- run_tool "$ZK_OP" -src "$ZK_SRC" -dst "$ZK_DST" $CONNECTION_PARAMS -recurse "$ZK_RECURSE" $VERBOSE --solr-home "$ZK_SOLR_HOME"+ run_tool "$ZK_OP" --source "$ZK_SRC" --destination "$ZK_DST" $CONNECTION_PARAMS --recurse "$ZK_RECURSE" $VERBOSE --solr-home "$ZK_SOLR_HOME"fi;;@@ -1035,7 +1040,7 @@ if [[ "$SCRIPT_CMD" == "zk" ]]; thenif [ -z "$ZK_SRC" ]; thenprint_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+ run_tool "$ZK_OP" --path "$ZK_SRC" --recurse "$ZK_RECURSE" $CONNECTION_PARAMS $VERBOSE;;mkroot)if [ -z "$ZK_SRC" ]; then@@ -1044,7 +1049,7 @@ if [[ "$SCRIPT_CMD" == "zk" ]]; thenrun_tool "$ZK_OP" --path "$ZK_SRC" $CONNECTION_PARAMS $VERBOSE;;linkconfig)- run_tool "$ZK_OP" --confname "$CONFIGSET_CONFNAME" -c "$ZK_COLLECTION" $CONNECTION_PARAMS $VERBOSE+ 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@@ -1061,7 +1066,7 @@ if [[ "$SCRIPT_CMD" == "package" ]]; thenif [ $# -gt 0 ]; thenwhile true; docase "$1" in- -help|-h)+ --help|-h|-help)print_usage "$SCRIPT_CMD"exit 0;;@@ -1093,47 +1098,47 @@ if [[ "$SCRIPT_CMD" == "auth" ]]; thenAUTH_PARAMS=("${AUTH_PARAMS[@]}" "$AUTH_OP")shift;;- -z|-zkhost|-zkHost)+ -z|--zk-host|-zkHost|--zkHost)ZK_HOST="$2"- AUTH_PARAMS=("${AUTH_PARAMS[@]}" "-zkHost" "$ZK_HOST")+ AUTH_PARAMS=("${AUTH_PARAMS[@]}" "-z" "$ZK_HOST")shift 2;;- -t|-type)+ -t|--type|-type)AUTH_TYPE="$2"- AUTH_PARAMS=("${AUTH_PARAMS[@]}" "-type" "$AUTH_TYPE")+ AUTH_PARAMS=("${AUTH_PARAMS[@]}" "--type" "$AUTH_TYPE")shift 2;;- -credentials)+ --credentials|-credentials)AUTH_CREDENTIALS="$2"- AUTH_PARAMS=("${AUTH_PARAMS[@]}" "-credentials" "$AUTH_CREDENTIALS")+ AUTH_PARAMS=("${AUTH_PARAMS[@]}" "--credentials" "$AUTH_CREDENTIALS")shift 2;;- -config)+ --config|-config)AUTH_CONFIG="$(echo "$2"| base64)"- AUTH_PARAMS=("${AUTH_PARAMS[@]}" "-config" "$AUTH_CONFIG")+ AUTH_PARAMS=("${AUTH_PARAMS[@]}" "--config" "$AUTH_CONFIG")shift 2;;- -solrIncludeFile)+ --solr-include-file|-solrIncludeFile)SOLR_INCLUDE="$2"shift 2;;- -prompt)- AUTH_PARAMS=("${AUTH_PARAMS[@]}" "-prompt" "$2")+ --prompt|-prompt)+ AUTH_PARAMS=("${AUTH_PARAMS[@]}" "--prompt" "$2")shift 2;;- -blockUnknown)- AUTH_PARAMS=("${AUTH_PARAMS[@]}" "-blockUnknown" "$2")+ --block-unknown|-blockUnknown)+ AUTH_PARAMS=("${AUTH_PARAMS[@]}" "--block-unknown" "$2")shift 2;;- -updateIncludeFileOnly)- AUTH_PARAMS=("${AUTH_PARAMS[@]}" "-updateIncludeFileOnly" "$2")+ --update-include-file-only|-updateIncludeFileOnly|--updateIncludeFileOnly)+ AUTH_PARAMS=("${AUTH_PARAMS[@]}" "--update-include-file-only" "$2")shift 2;;- -V|-verbose)- VERBOSE="-verbose"+ -v|--verbose|-verbose)+ VERBOSE="--verbose"shift;;- -d|-dir)+ -d|--dir|-dir)if [[ -z "$2" || "${2:0:1}" == "-" ]]; thenprint_usage "$SCRIPT_CMD" "Server directory is required when using the $1 option!"exit 1@@ -1153,7 +1158,7 @@ if [[ "$SCRIPT_CMD" == "auth" ]]; thenSOLR_SERVER_DIR="$(cd "$SOLR_SERVER_DIR" || (echo "SOLR_SERVER_DIR not found" && exit 1); pwd)"shift 2;;- -s|-solr.home)+ -s|--solr-home|-solr.home)if [[ -z "$2" || "${2:0:1}" == "-" ]]; thenprint_usage "$SCRIPT_CMD" "Solr home directory is required when using the $1 option!"exit 1@@ -1162,7 +1167,7 @@ if [[ "$SCRIPT_CMD" == "auth" ]]; thenSOLR_HOME="$2"shift 2;;- -help|-h)+ --help|-h|-help)print_usage "$SCRIPT_CMD"exit 0;;@@ -1200,7 +1205,7 @@ if [[ "$SCRIPT_CMD" == "auth" ]]; thenexit 0fi- AUTH_PARAMS=("${AUTH_PARAMS[@]}" "-solrIncludeFile" "$SOLR_INCLUDE")+ AUTH_PARAMS=("${AUTH_PARAMS[@]}" "--solr-include-file" "$SOLR_INCLUDE")if [ -z "${AUTH_PORT:-}" ]; thenfor ID in $(ps auxww | grep java | grep start\.jar | awk '{print $2}' | sort -r)@@ -1212,7 +1217,7 @@ if [[ "$SCRIPT_CMD" == "auth" ]]; thenfidonefi- run_tool auth "${AUTH_PARAMS[@]}" -solrUrl "$SOLR_URL_SCHEME://$SOLR_TOOL_HOST:${AUTH_PORT:-8983}" -authConfDir "$SOLR_HOME" $VERBOSE+ run_tool auth "${AUTH_PARAMS[@]}" --solr-url "$SOLR_URL_SCHEME://$SOLR_TOOL_HOST:${AUTH_PORT:-8983}" --auth-conf-dir "$SOLR_HOME" $VERBOSEexit $?fi@@ -1287,12 +1292,12 @@ PASS_TO_RUN_EXAMPLE=()if [ $# -gt 0 ]; thenwhile true; docase "${1:-}" in- -c|-cloud)+ -c|--cloud|-cloud)SOLR_MODE="solrcloud"PASS_TO_RUN_EXAMPLE+=("-c")shift;;- -d|-dir)+ -d|--dir|-dir)if [[ -z "$2" || "${2:0:1}" == "-" ]]; thenprint_usage "$SCRIPT_CMD" "Server directory is required when using the $1 option!"exit 1@@ -1312,7 +1317,7 @@ if [ $# -gt 0 ]; thenSOLR_SERVER_DIR="$(cd "$SOLR_SERVER_DIR" || (echo "SOLR_SERVER_DIR not found" && exit 1); pwd)"shift 2;;- -s|-solr.home)+ -s|--solr-home|-solr.home)if [[ -z "$2" || "${2:0:1}" == "-" ]]; thenprint_usage "$SCRIPT_CMD" "Solr home directory is required when using the $1 option!"exit 1@@ -1321,11 +1326,11 @@ if [ $# -gt 0 ]; thenSOLR_HOME="$2"shift 2;;- -t|-data.home)+ -t|--data-home|-data.home)SOLR_DATA_HOME="$2"shift 2;;- -e|-example)+ -e|--example|-example)if [[ -z "$2" || "${2:0:1}" == "-" ]]; thenprint_usage "$SCRIPT_CMD" "Example name is required when using the $1 option!"exit 1@@ -1333,20 +1338,20 @@ if [ $# -gt 0 ]; thenEXAMPLE="$2"shift 2;;- -f|-foreground)+ -f|--foreground|-foreground)FG="true"shift;;- -host)+ --host|-host)if [[ -z "$2" || "${2:0:1}" == "-" ]]; thenprint_usage "$SCRIPT_CMD" "Hostname is required when using the $1 option!"exit 1fiSOLR_HOST="$2"- PASS_TO_RUN_EXAMPLE+=("-host" "$SOLR_HOST")+ PASS_TO_RUN_EXAMPLE+=("--host" "$SOLR_HOST")shift 2;;- -m|-memory)+ -m|--memory|-memory)if [[ -z "$2" || "${2:0:1}" == "-" ]]; thenprint_usage "$SCRIPT_CMD" "Memory setting is required when using the $1 option!"exit 1@@ -1355,7 +1360,7 @@ if [ $# -gt 0 ]; thenPASS_TO_RUN_EXAMPLE+=("-m" "$SOLR_HEAP")shift 2;;- -p|-port)+ -p|--port|-port)if [[ -z "$2" || "${2:0:1}" == "-" ]]; thenprint_usage "$SCRIPT_CMD" "Port number is required when using the $1 option!"exit 1@@ -1365,7 +1370,7 @@ if [ $# -gt 0 ]; thenPASS_TO_RUN_EXAMPLE+=("-p" "$SOLR_PORT")shift 2;;- -z|-zkhost|-zkHost)+ -z|--zk-host|-zkHost|--zkHost)if [[ -z "$2" || "${2:0:1}" == "-" ]]; thenprint_usage "$SCRIPT_CMD" "Zookeeper connection string is required when using the $1 option!"exit 1@@ -1375,31 +1380,31 @@ if [ $# -gt 0 ]; thenPASS_TO_RUN_EXAMPLE+=("-z" "$ZK_HOST")shift 2;;- -a|-addlopts)+ -a|--additional-options|-addlopts)ADDITIONAL_CMD_OPTS="$2"PASS_TO_RUN_EXAMPLE+=("-a" "$ADDITIONAL_CMD_OPTS")shift 2;;- -j|-jettyconfig)+ -j|--jettyconfig|-jettyconfig)ADDITIONAL_JETTY_CONFIG="$2"PASS_TO_RUN_EXAMPLE+=("-j" "$ADDITIONAL_JETTY_CONFIG")shift 2;;- -k|-key)+ -k|--key|-key)STOP_KEY="$2"shift 2;;- -help|-h)+ -h|--help|-help)print_usage "$SCRIPT_CMD"exit 0;;- -noprompt)- PASS_TO_RUN_EXAMPLE+=("-noprompt")+ --noprompt|-noprompt|--no-prompt)+ PASS_TO_RUN_EXAMPLE+=("--no-prompt")shift;;- -V|-verbose)+ -V|--verbose|-verbose)verbose=true- PASS_TO_RUN_EXAMPLE+=("-verbose")+ PASS_TO_RUN_EXAMPLE+=("--verbose")shift;;-v)@@ -1410,13 +1415,13 @@ if [ $# -gt 0 ]; thenSOLR_LOG_LEVEL=WARNshift;;- -all)+ --all|-all)stop_all=trueshift;;- -force)+ --force|-force)FORCE=true- PASS_TO_RUN_EXAMPLE+=("-force")+ PASS_TO_RUN_EXAMPLE+=("--force")shift;;--)@@ -1474,7 +1479,7 @@ fi# otherwise let this script proceed to process the user request#if [ -n "${EXAMPLE:-}" ] && [ "$SCRIPT_CMD" == "start" ]; then- run_tool run_example -e "$EXAMPLE" -d "$SOLR_SERVER_DIR" -urlScheme "$SOLR_URL_SCHEME" "${PASS_TO_RUN_EXAMPLE[@]}"+ run_tool run_example -e "$EXAMPLE" -d "$SOLR_SERVER_DIR" --url-scheme "$SOLR_URL_SCHEME" "${PASS_TO_RUN_EXAMPLE[@]}"exit $?fi@@ -1522,7 +1527,7 @@ if [[ "$SCRIPT_CMD" == "stop" ]]; thennone_stopped=truenumSolrs=$(find "$SOLR_PID_DIR" -name "solr-*.pid" -type f | wc -l | tr -d ' ')if [ "$numSolrs" -eq 1 ]; then- # only do this if there is only 1 node running, otherwise they must provide the -p or -all+ # only do this if there is only 1 node running, otherwise they must provide the -p or --allPID="$(cat "$(find "$SOLR_PID_DIR" -name "solr-*.pid" -type f)")"CHECK_PID=$(ps -o pid='' -p "$PID" | tr -d ' ')if [ "$CHECK_PID" != "" ]; then@@ -1536,7 +1541,7 @@ if [[ "$SCRIPT_CMD" == "stop" ]]; thenif $none_stopped; thenif [ "$numSolrs" -gt 0 ]; then- echo -e "\nFound $numSolrs Solr nodes running! Must either specify a port using -p or -all to stop all Solr nodes on this host.\n"+ echo -e "\nFound $numSolrs Solr nodes running! Must either specify a port using -p or --all to stop all Solr nodes on this host.\n"elseecho -e "\nNo Solr nodes found to stop.\n"fi@@ -1563,7 +1568,7 @@ fiif [ "$SCRIPT_CMD" == "start" ] || [ "$SCRIPT_CMD" == "restart" ] ; thenif [[ $EUID -eq 0 ]] && [[ "$FORCE" == "false" ]] ; thenecho "WARNING: Starting Solr as the root user is a security risk and not considered best practice. Exiting."- echo " Please consult the Reference Guide. To override this check, start with argument '-force'"+ echo " Please consult the Reference Guide. To override this check, start with argument '--force'"exit 1fifidiff --git a/solr/bin/solr.cmd b/solr/bin/solr.cmdindex faf51b4eafc..041d7701aa5 100755--- a/solr/bin/solr.cmd+++ b/solr/bin/solr.cmd@@ -250,6 +250,7 @@ IF "%1"=="-help" goto run_solrcliIF "%1"=="-usage" goto run_solrcliIF "%1"=="-h" goto run_solrcliIF "%1"=="--help" goto run_solrcli+IF "%1"=="-help" goto run_solrcliIF "%1"=="/?" goto run_solrcliIF "%1"=="status" goto get_statusIF "%1"=="version" goto run_solrcli@@ -291,6 +292,7 @@ IF "%FIRST_ARG%"=="-help" goto run_solrcliIF "%FIRST_ARG%"=="-usage" goto run_solrcliIF "%FIRST_ARG%"=="-h" goto run_solrcliIF "%FIRST_ARG%"=="--help" goto run_solrcli+IF "%FIRST_ARG%"=="-help" goto run_solrcliIF "%FIRST_ARG%"=="/?" goto run_solrcliIF "%SCRIPT_CMD%"=="start" goto start_usageIF "%SCRIPT_CMD%"=="restart" goto start_usage@@ -307,7 +309,7 @@ goto done:start_usage@echo.-@echo Usage: solr %SCRIPT_CMD% [-f] [-c] [-h hostname] [-p port] [-d directory] [-z zkHost] [-m memory] [-e example] [-s solr.solr.home] [-t solr.data.home] [-a "additional-options"] [-V]+@echo Usage: solr %SCRIPT_CMD% [-f] [-c] [--host hostname] [-p port] [-d directory] [-z zkHost] [-m memory] [-e example] [-s solr.solr.home] [-t solr.data.home] [-a "additional-options"] [-V]@echo.@echo -f Start Solr in foreground; default starts Solr in the background@echo and sends stdout / stderr to solr-PORT-console.log@@ -316,7 +318,7 @@ goto done@echo solr.in.cmd, an embedded ZooKeeper instance is started on Solr port+1000,@echo such as 9983 if Solr is bound to 8983@echo.-@echo -host host Specify the hostname for this Solr instance+@echo --host host Specify the hostname for this Solr instance@echo.@echo -p port Specify the port to start the Solr HTTP listener on; default is 8983@echo The specified port (SOLR_PORT) will also be used to determine the stop port@@ -360,11 +362,11 @@ goto done@echo you could pass: -j "--include-jetty-dir=/etc/jetty/custom/server/"@echo In most cases, you should wrap the additional parameters in double quotes.@echo.-@echo -noprompt Don't prompt for input; accept all defaults when running examples that accept user input+@echo --no-prompt Don't prompt for input; accept all defaults when running examples that accept user input@echo.@echo -v and -q Verbose (-v) or quiet (-q) logging. Sets default log level to DEBUG or WARN instead of INFO@echo.-@echo -V/-verbose Verbose messages from this script+@echo -V/--verbose Verbose messages from this script@echo.goto done@@ -372,13 +374,13 @@ goto done@echo.@echo Usage: solr stop [-k key] [-p port] [-V]@echo.-@echo -k key Stop key; default is solrrocks+@echo -k key Stop key; default is solrrocks@echo.-@echo -p port Specify the port the Solr HTTP listener is bound to+@echo -p port Specify the port the Solr HTTP listener is bound to@echo.-@echo -all Find and stop all running Solr servers on this host+@echo --all Find and stop all running Solr servers on this host@echo.-@echo -V/-verbose Verbose messages from this script+@echo -V/--verbose Verbose messages from this script@echo.@echo NOTE: To see if any Solr servers are running, do: solr status@echo.@@ -479,37 +481,37 @@ echo solr zk rm [-r] ^<path^> [-z zkHost] [-s solrUrl]echo solr zk mv ^<src^> ^<dest^> [-z zkHost] [-s solrUrl]echo solr zk ls [-r] ^<path^> [-z zkHost] [-s solrUrl]echo solr zk mkroot ^<path^> [-z zkHost] [-s solrUrl]-echo solr zk linkconfig -confname ^<confname^> -c ^<collection^> [-z zkHost] [-s solrUrl]+echo solr zk linkconfig --conf-name ^<confname^> -c ^<collection^> [-z zkHost] [-s solrUrl]echo solr zk updateacls ^<path^> [-z zkHost] [-s solrUrl]echo.IF "%ZK_FULL%"=="true" (goto zk_full_usage) ELSE (- echo Type bin/solr zk -help for full usage help+ echo Type bin/solr zk --help for full usage help)goto done:auth_usage-echo Usage: solr auth enable [-type basicAuth] -credentials user:pass [-blockUnknown ^<true^|false^>] [-updateIncludeFileOnly ^<true^|false^>] [-V]-echo solr auth enable [-type basicAuth] -prompt ^<true^|false^> [-blockUnknown ^<true^|false^>] [-updateIncludeFileOnly ^<true^|false^>] [-V]-echo solr auth disable [-updateIncludeFileOnly ^<true^|false^>] [-V]+echo Usage: solr auth enable [--type basicAuth] --credentials user:pass [--block-unknown ^<true^|false^>] [--update-include-file-only ^<true^|false^>] [-v]+echo solr auth enable [--type basicAuth] --prompt ^<true^|false^> [--block-unknown ^<true^|false^>] [--update-include-file-only ^<true^|false^>] [-v]+echo solr auth disable [--update-include-file-only ^<true^|false^>] [-v]echo.echo Updates or enables/disables authentication. Must be run on the machine hosting Solr.echo.-echo -type ^<type^> The authentication mechanism to enable. Defaults to 'basicAuth'.+echo --type ^<type^> The authentication mechanism to enable. Defaults to 'basicAuth'.echo.-echo -credentials ^<user:pass^> The username and password of the initial user-echo Note: only one of -prompt or -credentials must be provided+echo --credentials ^<user:pass^> The username and password of the initial user+echo Note: only one of --prompt or --credentials must be providedecho.-echo -prompt ^<true^|false^> Prompts the user to provide the credentials-echo Note: only one of -prompt or -credentials must be provided+echo --prompt ^<true^|false^> Prompts the user to provide the credentials+echo Note: only one of --prompt or --credentials must be providedecho.-echo -blockUnknown ^<true^|false^> When true, this blocks out access to unauthenticated users. When not provided,+echo --block-unknown ^<true^|false^> When true, this blocks out access to unauthenticated users. When not provided,echo this defaults to false (i.e. unauthenticated users can access all endpoints, except theecho operations like collection-edit, security-edit, core-admin-edit etc.^). Check the referenceecho guide for Basic Authentication for more details.echo.-echo -updateIncludeFileOnly ^<true^|false^> Only update the solr.in.sh or solr.in.cmd file, and skip actual enabling/disabling"+echo --update-include-file-only ^<true^|false^> Only update the solr.in.sh or solr.in.cmd file, and skip actual enabling/disabling"echo authentication (i.e. don't update security.json^)"echo.echo -z zkHost Zookeeper connection string. Unnecessary if ZK_HOST is defined in solr.in.cmd.@@ -519,7 +521,7 @@ echo.echo -s ^<dir^> Specify the Solr home directory. This is where any credentials or authentication"echo configuration files (e.g. basicAuth.conf^) would be placed."echo.-echo -V Enable more verbose output+echo -v Enable more verbose outputecho.goto done@@ -535,37 +537,42 @@ IF "%1"=="-h" goto usageIF "%1"=="-usage" goto usageIF "%1"=="/?" goto usageIF "%1"=="-f" goto set_foreground_mode-IF "%1"=="-foreground" goto set_foreground_mode+IF "%1"=="--foreground" goto set_foreground_modeIF "%1"=="-V" goto set_verbose-IF "%1"=="-verbose" goto set_verbose+IF "%1"=="--verbose" goto set_verboseIF "%1"=="-v" goto set_debugIF "%1"=="-q" goto set_warnIF "%1"=="-c" goto set_cloud_modeIF "%1"=="-cloud" goto set_cloud_modeIF "%1"=="-d" goto set_server_dir-IF "%1"=="-dir" goto set_server_dir+IF "%1"=="--dir" goto set_server_dirIF "%1"=="-s" goto set_solr_home_dir+IF "%1"=="--solr-home" goto set_solr_home_dirIF "%1"=="-t" goto set_solr_data_dir-IF "%1"=="-solr.home" goto set_solr_home_dir+IF "%1"=="--solr-data" goto set_solr_data_dirIF "%1"=="-e" goto set_example-IF "%1"=="-example" goto set_example-IF "%1"=="-host" goto set_host+IF "%1"=="--example" goto set_example+IF "%1"=="--host" goto set_hostIF "%1"=="-m" goto set_memory-IF "%1"=="-memory" goto set_memory+IF "%1"=="--memory" goto set_memoryIF "%1"=="-p" goto set_port-IF "%1"=="-port" goto set_port+IF "%1"=="--port" goto set_portIF "%1"=="-z" goto set_zookeeper-IF "%1"=="-zkhost" goto set_zookeeper+IF "%1"=="--zk-host" goto set_zookeeperIF "%1"=="-zkHost" goto set_zookeeper+IF "%1"=="--zkHost" goto set_zookeeperIF "%1"=="-s" goto set_solr_url+IF "%1"=="--solr-url" goto set_solr_urlIF "%1"=="-solrUrl" goto set_solr_urlIF "%1"=="-a" goto set_addl_opts-IF "%1"=="-addlopts" goto set_addl_opts+IF "%1"=="--additional-options" goto set_addl_optsIF "%1"=="-j" goto set_addl_jetty_config-IF "%1"=="-jettyconfig" goto set_addl_jetty_config-IF "%1"=="-noprompt" goto set_noprompt+IF "%1"=="--jettyconfig" goto set_addl_jetty_config+IF "%1"=="--noprompt" goto set_noprompt+IF "%1"=="--no-prompt" goto set_nopromptIF "%1"=="-k" goto set_stop_key-IF "%1"=="-key" goto set_stop_key+IF "%1"=="--key" goto set_stop_key+IF "%1"=="--all" goto set_stop_allIF "%1"=="-all" goto set_stop_allIF "%firstTwo%"=="-D" goto set_passthruIF NOT "%1"=="" goto invalid_cmd_line@@ -821,7 +828,7 @@ goto parse_args:set_nopromptset NO_USER_PROMPT=1-set "PASS_TO_RUN_EXAMPLE=-noprompt !PASS_TO_RUN_EXAMPLE!"+set "PASS_TO_RUN_EXAMPLE=--no-prompt !PASS_TO_RUN_EXAMPLE!"SHIFTgoto parse_args@@ -950,7 +957,7 @@ IF "%SCRIPT_CMD%"=="stop" ()if "!found_it!"=="0" echo No Solr nodes found to stop.) ELSE (- set "SCRIPT_ERROR=Must specify the port when trying to stop Solr, or use -all to stop all running nodes on this host."+ set "SCRIPT_ERROR=Must specify the port when trying to stop Solr, or use --all to stop all running nodes on this host."goto err)) ELSE (@@ -1314,7 +1321,7 @@ IF "%FG%"=="1" ("%JAVA%" %SOLR_SSL_OPTS% %AUTHC_OPTS% %SOLR_ZK_CREDS_AND_ACLS% %SOLR_TOOL_OPTS% -Dsolr.install.dir="%SOLR_TIP%" -Dsolr.default.confdir="%DEFAULT_CONFDIR%"^-Dlog4j.configurationFile="file:///%DEFAULT_SERVER_DIR%\resources\log4j2-console.xml" ^-classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*" ^- org.apache.solr.cli.SolrCLI status -maxWaitSecs !SOLR_START_WAIT! -solrUrl !SOLR_URL_SCHEME!://%SOLR_TOOL_HOST%:%SOLR_PORT%/solr+ org.apache.solr.cli.SolrCLI status --max-wait-secs !SOLR_START_WAIT! --solr-url !SOLR_URL_SCHEME!://%SOLR_TOOL_HOST%:%SOLR_PORT%IF NOT "!ERRORLEVEL!"=="0" (set "SCRIPT_ERROR=Solr did not start or was not reachable. Check the logs for errors."goto err@@ -1330,8 +1337,8 @@ REM Run the requested example-Dlog4j.configurationFile="file:///%DEFAULT_SERVER_DIR%\resources\log4j2-console.xml" ^-Dsolr.install.symDir="%SOLR_TIP%" ^-classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*" ^- org.apache.solr.cli.SolrCLI run_example -script "%SDIR%\solr.cmd" -e %EXAMPLE% -d "%SOLR_SERVER_DIR%" ^- -urlScheme !SOLR_URL_SCHEME! !PASS_TO_RUN_EXAMPLE!+ org.apache.solr.cli.SolrCLI run_example --script "%SDIR%\solr.cmd" -e %EXAMPLE% -d "%SOLR_SERVER_DIR%" ^+ --url-scheme !SOLR_URL_SCHEME! !PASS_TO_RUN_EXAMPLE!REM End of run_examplegoto done@@ -1349,11 +1356,11 @@ for /f "usebackq" %%i in (`dir /b "%SOLR_TIP%\bin" ^| findstr /i "^solr-.*\.port@echo.set has_info=1echo Found Solr process %%k running on port !SOME_SOLR_PORT!- REM Passing in %2 (-h or -help) directly is captured by a custom help path for usage output+ REM Passing in %2 (-h or --help) directly is captured by a custom help path for usage output"%JAVA%" %SOLR_SSL_OPTS% %AUTHC_OPTS% %SOLR_ZK_CREDS_AND_ACLS% %SOLR_TOOL_OPTS% -Dsolr.install.dir="%SOLR_TIP%" ^-Dlog4j.configurationFile="file:///%DEFAULT_SERVER_DIR%\resources\log4j2-console.xml" ^-classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*" ^- org.apache.solr.cli.SolrCLI status -solrUrl !SOLR_URL_SCHEME!://%SOLR_TOOL_HOST%:!SOME_SOLR_PORT!/solr %2+ org.apache.solr.cli.SolrCLI status --solr-url !SOLR_URL_SCHEME!://%SOLR_TOOL_HOST%:!SOME_SOLR_PORT! %2@echo.))@@ -1377,8 +1384,9 @@ goto done:parse_config_argsIF [%1]==[] goto run_configIF "%1"=="-z" goto set_config_zk-IF "%1"=="-zkhost" goto set_config_zk+IF "%1"=="--zk-host" goto set_config_zkIF "%1"=="-zkHost" goto set_config_zk+IF "%1"=="--zkHost" goto set_config_zkIF "%1"=="-s" goto set_config_url_schemeIF "%1"=="-scheme" goto set_config_url_schemeset "CONFIG_ARGS=!CONFIG_ARGS! %1"@@ -1429,6 +1437,8 @@ IF "%1"=="-V" (goto set_configdir) ELSE IF "%1"=="-confdir" (goto set_configdir+) ELSE IF "%1"=="--conf-dir" (+ goto set_configdir) ELSE IF "%1"=="-c" (goto set_collection_zk) ELSE IF "%1"=="-z" (@@ -1463,7 +1473,7 @@ SHIFTgoto parse_zk_args:set_zk_verbose-set ZK_VERBOSE="-verbose"+set ZK_VERBOSE="--verbose"SHIFTgoto parse_zk_args@@ -1533,8 +1543,7 @@ IF "!ZK_OP!"=="upconfig" ("%JAVA%" %SOLR_SSL_OPTS% %AUTHC_OPTS% %SOLR_ZK_CREDS_AND_ACLS% %SOLR_TOOL_OPTS% -Dsolr.install.dir="%SOLR_TIP%" ^-Dlog4j.configurationFile="file:///%DEFAULT_SERVER_DIR%\resources\log4j2-console.xml" ^-classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*" ^- org.apache.solr.cli.SolrCLI !ZK_OP! -confname !CONFIGSET_NAME! -confdir !CONFIGSET_DIR! %CONNECTION_PARAMS% %ZK_VERBOSE%^- -configsetsDir "%SOLR_TIP%/server/solr/configsets"+ org.apache.solr.cli.SolrCLI !ZK_OP! --conf-name !CONFIGSET_NAME! --conf-dir !CONFIGSET_DIR! %CONNECTION_PARAMS% %ZK_VERBOSE%^) ELSE IF "!ZK_OP!"=="downconfig" (IF "!CONFIGSET_NAME!"=="" (set ERROR_MSG="-n option must be set for downconfig"@@ -1547,7 +1556,7 @@ IF "!ZK_OP!"=="upconfig" ("%JAVA%" %SOLR_SSL_OPTS% %AUTHC_OPTS% %SOLR_ZK_CREDS_AND_ACLS% %SOLR_TOOL_OPTS% -Dsolr.install.dir="%SOLR_TIP%" ^-Dlog4j.configurationFile="file:///%DEFAULT_SERVER_DIR%\resources\log4j2-console.xml" ^-classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*" ^- org.apache.solr.cli.SolrCLI !ZK_OP! -confname !CONFIGSET_NAME! -confdir !CONFIGSET_DIR! -zkHost !ZK_HOST! %ZK_VERBOSE%+ org.apache.solr.cli.SolrCLI !ZK_OP! --conf-name !CONFIGSET_NAME! --conf-dir !CONFIGSET_DIR! -z !ZK_HOST! %ZK_VERBOSE%) ELSE IF "!ZK_OP!"=="linkconfig" (IF "!CONFIGSET_NAME!"=="" (set ERROR_MSG="-n option must be set for linkconfig"@@ -1560,7 +1569,7 @@ IF "!ZK_OP!"=="upconfig" ("%JAVA%" %SOLR_SSL_OPTS% %AUTHC_OPTS% %SOLR_ZK_CREDS_AND_ACLS% %SOLR_TOOL_OPTS% -Dsolr.install.dir="%SOLR_TIP%" ^-Dlog4j.configurationFile="file:///%DEFAULT_SERVER_DIR%\resources\log4j2-console.xml" ^-classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*" ^- org.apache.solr.cli.SolrCLI !ZK_OP! -confname !CONFIGSET_NAME! -c !ZK_COLLECTION! -zkHost !ZK_HOST! %ZK_VERBOSE%+ org.apache.solr.cli.SolrCLI !ZK_OP! --conf-name !CONFIGSET_NAME! -c !ZK_COLLECTION! -z !ZK_HOST! %ZK_VERBOSE%) ELSE IF "!ZK_OP!"=="updateacls" (IF "%ZK_SRC"=="" (set ERROR_MSG="Zookeeper path to remove must be specified when using the 'ls' command"@@ -1569,7 +1578,7 @@ IF "!ZK_OP!"=="upconfig" ("%JAVA%" %SOLR_SSL_OPTS% %AUTHC_OPTS% %SOLR_ZK_CREDS_AND_ACLS% %SOLR_TOOL_OPTS% -Dsolr.install.dir="%SOLR_TIP%" ^-Dlog4j.configurationFile="file:///%DEFAULT_SERVER_DIR%\resources\log4j2-console.xml" ^-classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*" ^- org.apache.solr.cli.SolrCLI !ZK_OP! -path !ZK_SRC! -zkHost !ZK_HOST! %ZK_VERBOSE%+ org.apache.solr.cli.SolrCLI !ZK_OP! --path !ZK_SRC! -z !ZK_HOST! %ZK_VERBOSE%) ELSE IF "!ZK_OP!"=="cp" (IF "%ZK_SRC%"=="" (set ERROR_MSG="<src> must be specified for 'cp' command"@@ -1588,7 +1597,7 @@ IF "!ZK_OP!"=="upconfig" ("%JAVA%" %SOLR_SSL_OPTS% %AUTHC_OPTS% %SOLR_ZK_CREDS_AND_ACLS% %SOLR_TOOL_OPTS% -Dsolr.install.dir="%SOLR_TIP%" ^-Dlog4j.configurationFile="file:///%DEFAULT_SERVER_DIR%\resources\log4j2-console.xml" ^-classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*" ^- org.apache.solr.cli.SolrCLI !ZK_OP! -zkHost !ZK_HOST! -src !ZK_SRC! -dst !ZK_DST! -recurse !ZK_RECURSE! %ZK_VERBOSE%+ org.apache.solr.cli.SolrCLI !ZK_OP! -z !ZK_HOST! --source !ZK_SRC! --destination !ZK_DST! --recurse !ZK_RECURSE! %ZK_VERBOSE%) ELSE IF "!ZK_OP!"=="mv" (IF "%ZK_SRC%"=="" (set ERROR_MSG="<src> must be specified for 'mv' command"@@ -1601,7 +1610,7 @@ IF "!ZK_OP!"=="upconfig" ("%JAVA%" %SOLR_SSL_OPTS% %AUTHC_OPTS% %SOLR_ZK_CREDS_AND_ACLS% %SOLR_TOOL_OPTS% -Dsolr.install.dir="%SOLR_TIP%" ^-Dlog4j.configurationFile="file:///%DEFAULT_SERVER_DIR%\resources\log4j2-console.xml" ^-classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*" ^- org.apache.solr.cli.SolrCLI !ZK_OP! -zkHost !ZK_HOST! -src !ZK_SRC! -dst !ZK_DST! %ZK_VERBOSE%+ org.apache.solr.cli.SolrCLI !ZK_OP! -z !ZK_HOST! --source !ZK_SRC! --destination !ZK_DST! %ZK_VERBOSE%) ELSE IF "!ZK_OP!"=="rm" (IF "%ZK_SRC"=="" (set ERROR_MSG="Zookeeper path to remove must be specified when using the 'rm' command"@@ -1610,7 +1619,7 @@ IF "!ZK_OP!"=="upconfig" ("%JAVA%" %SOLR_SSL_OPTS% %AUTHC_OPTS% %SOLR_ZK_CREDS_AND_ACLS% %SOLR_TOOL_OPTS% -Dsolr.install.dir="%SOLR_TIP%" ^-Dlog4j.configurationFile="file:///%DEFAULT_SERVER_DIR%\resources\log4j2-console.xml" ^-classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*" ^- org.apache.solr.cli.SolrCLI !ZK_OP! -zkHost !ZK_HOST! -path !ZK_SRC! -recurse !ZK_RECURSE! %ZK_VERBOSE%+ org.apache.solr.cli.SolrCLI !ZK_OP! -z !ZK_HOST! --path !ZK_SRC! --recurse !ZK_RECURSE! %ZK_VERBOSE%) ELSE IF "!ZK_OP!"=="ls" (IF "%ZK_SRC"=="" (set ERROR_MSG="Zookeeper path to remove must be specified when using the 'ls' command"@@ -1619,7 +1628,7 @@ IF "!ZK_OP!"=="upconfig" ("%JAVA%" %SOLR_SSL_OPTS% %AUTHC_OPTS% %SOLR_ZK_CREDS_AND_ACLS% %SOLR_TOOL_OPTS% -Dsolr.install.dir="%SOLR_TIP%" ^-Dlog4j.configurationFile="file:///%DEFAULT_SERVER_DIR%\resources\log4j2-console.xml" ^-classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*" ^- org.apache.solr.cli.SolrCLI !ZK_OP! -zkHost !ZK_HOST! -path !ZK_SRC! -recurse !ZK_RECURSE! %ZK_VERBOSE%+ org.apache.solr.cli.SolrCLI !ZK_OP! -z !ZK_HOST! --path !ZK_SRC! --recurse !ZK_RECURSE! %ZK_VERBOSE%) ELSE IF "!ZK_OP!"=="mkroot" (IF "%ZK_SRC"=="" (set ERROR_MSG="Zookeeper path to create must be specified when using the 'mkroot' command"@@ -1628,7 +1637,7 @@ IF "!ZK_OP!"=="upconfig" ("%JAVA%" %SOLR_SSL_OPTS% %AUTHC_OPTS% %SOLR_ZK_CREDS_AND_ACLS% %SOLR_TOOL_OPTS% -Dsolr.install.dir="%SOLR_TIP%" ^-Dlog4j.configurationFile="file:///%SOLR_SERVER_DIR%\resources\log4j2-console.xml" ^-classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*" ^- org.apache.solr.cli.SolrCLI !ZK_OP! -zkHost !ZK_HOST! -path !ZK_SRC! %ZK_VERBOSE%+ org.apache.solr.cli.SolrCLI !ZK_OP! -z !ZK_HOST! --path !ZK_SRC! %ZK_VERBOSE%) ELSE (set ERROR_MSG="Unknown zk option !ZK_OP!"goto zk_short_usage@@ -1689,8 +1698,8 @@ if "!AUTH_PORT!"=="" ("%JAVA%" %SOLR_SSL_OPTS% %AUTHC_OPTS% %SOLR_ZK_CREDS_AND_ACLS% %SOLR_TOOL_OPTS% -Dsolr.install.dir="%SOLR_TIP%" ^-Dlog4j.configurationFile="file:///%DEFAULT_SERVER_DIR%\resources\log4j2-console.xml" ^-classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*" ^- org.apache.solr.cli.SolrCLI auth %AUTH_PARAMS% -solrIncludeFile "%SOLR_INCLUDE%" -authConfDir "%SOLR_HOME%" ^- -solrUrl !SOLR_URL_SCHEME!://%SOLR_TOOL_HOST%:!AUTH_PORT!+ org.apache.solr.cli.SolrCLI auth %AUTH_PARAMS% --solr-include-file "%SOLR_INCLUDE%" --auth-conf-dir "%SOLR_HOME%" ^+ --solr-url !SOLR_URL_SCHEME!://%SOLR_TOOL_HOST%:!AUTH_PORT!goto donediff --git a/solr/core/build.gradle b/solr/core/build.gradleindex 1c043353ec9..b91f2db168f 100644--- a/solr/core/build.gradle+++ b/solr/core/build.gradle@@ -191,5 +191,3 @@ dependencies {exclude group: "net.bytebuddy", module: "byte-buddy-agent"})}--diff --git a/solr/core/src/java/org/apache/solr/cli/ApiTool.java b/solr/core/src/java/org/apache/solr/cli/ApiTool.javaindex 2b760cc7f76..dba8357aac0 100644--- a/solr/core/src/java/org/apache/solr/cli/ApiTool.java+++ b/solr/core/src/java/org/apache/solr/cli/ApiTool.java@@ -21,6 +21,7 @@ import java.io.PrintStream;import java.net.URI;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.client.solrj.SolrRequest;import org.apache.solr.client.solrj.impl.JsonMapResponseParser;@@ -52,10 +53,24 @@ public class ApiTool extends ToolBase {@Overridepublic List<Option> getOptions() {return List.of(+ Option.builder()+ .longOpt("solr-url")+ .argName("URL")+ .hasArg()+ .required(false) // swap back to required when we eliminate deprecated option+ .desc("Send a GET request to a Solr API endpoint.")+ .build(),Option.builder("get")+ .longOpt("get")+ .deprecated(+ DeprecatedAttributes.builder()+ .setForRemoval(true)+ .setSince("9.7")+ .setDescription("Use --solr-url instead")+ .get()).argName("URL").hasArg()- .required(true)+ .required(false).desc("Send a GET request to a Solr API endpoint.").build(),SolrCLI.OPTION_CREDENTIALS);@@ -64,7 +79,8 @@ public class ApiTool extends ToolBase {@Overridepublic void runImpl(CommandLine cli) throws Exception {String response = null;- String getUrl = cli.getOptionValue("get");+ String getUrl =+ cli.hasOption("solr-url") ? cli.getOptionValue("solr-url") : cli.getOptionValue("get");if (getUrl != null) {response = callGet(getUrl, cli.getOptionValue(SolrCLI.OPTION_CREDENTIALS.getLongOpt()));}diff --git a/solr/core/src/java/org/apache/solr/cli/AssertTool.java b/solr/core/src/java/org/apache/solr/cli/AssertTool.javaindex 8976212778f..73f9cc761b6 100644--- a/solr/core/src/java/org/apache/solr/cli/AssertTool.java+++ b/solr/core/src/java/org/apache/solr/cli/AssertTool.java@@ -77,7 +77,7 @@ public class AssertTool extends ToolBase {.hasArg(true).argName("url").build(),- Option.builder("u")+ Option.builder().desc("Asserts that we run as same user that owns <directory>.").longOpt("same-user").hasArg(true)@@ -126,14 +126,7 @@ public class AssertTool extends ToolBase {.desc("Return an exit code instead of printing error message on assert fail.").longOpt("exitcode").build(),- // u was taken, can we change that instead?- Option.builder("credentials")- .argName("credentials")- .hasArg()- .required(false)- .desc(- "Credentials in the format username:password. Example: --credentials solr:SolrRocks")- .build());+ SolrCLI.OPTION_CREDENTIALS);}@Override@@ -196,8 +189,8 @@ public class AssertTool extends ToolBase {if (cli.hasOption("X")) {ret += assertFileNotExists(cli.getOptionValue("X"));}- if (cli.hasOption("u")) {- ret += sameUser(cli.getOptionValue("u"));+ if (cli.hasOption("same-user")) {+ ret += sameUser(cli.getOptionValue("same-user"));}if (cli.hasOption("s")) {ret +=diff --git a/solr/core/src/java/org/apache/solr/cli/AuthTool.java b/solr/core/src/java/org/apache/solr/cli/AuthTool.javaindex 8dfeb5cf088..47d4861370a 100644--- a/solr/core/src/java/org/apache/solr/cli/AuthTool.java+++ b/solr/core/src/java/org/apache/solr/cli/AuthTool.java@@ -66,54 +66,55 @@ public class AuthTool extends ToolBase {@Overridepublic List<Option> getOptions() {return List.of(- Option.builder("type")- .argName("type")+ Option.builder()+ .longOpt("type").hasArg().desc("The authentication mechanism to enable (basicAuth or kerberos). Defaults to 'basicAuth'.").build(),- SolrCLI.OPTION_CREDENTIALS,- Option.builder("prompt")- .argName("prompt")+ Option.builder()+ .longOpt("prompt").hasArg().desc(- "Prompts the user to provide the credentials. Use either -credentials or -prompt, not both.")+ "Prompts the user to provide the credentials. Use either --credentials or --prompt, not both.").build(),- Option.builder("config")- .argName("config")+ Option.builder()+ .longOpt("config").hasArgs().desc("Configuration parameters (Solr startup parameters). Required for Kerberos authentication.").build(),- Option.builder("blockUnknown")- .argName("blockUnknown")+ Option.builder()+ .longOpt("block-unknown").desc("Blocks all access for unknown users (requires authentication for all endpoints).").hasArg().build(),- Option.builder("solrIncludeFile")- .argName("solrIncludeFile")+ Option.builder()+ .longOpt("solr-include-file").hasArg().desc("The Solr include file which contains overridable environment variables for configuring Solr configurations.").build(),- Option.builder("updateIncludeFileOnly")- .argName("updateIncludeFileOnly")+ Option.builder()+ .longOpt("update-include-file-only").desc("Only update the solr.in.sh or solr.in.cmd file, and skip actual enabling/disabling"+ " authentication (i.e. don't update security.json).").hasArg().build(),- Option.builder("authConfDir")- .argName("authConfDir")+ Option.builder()+ .longOpt("auth-conf-dir").hasArg().required().desc("This is where any authentication related configuration files, if any, would be placed.").build(),SolrCLI.OPTION_SOLRURL,+ SolrCLI.OPTION_SOLRURL_DEPRECATED,SolrCLI.OPTION_ZKHOST,- SolrCLI.OPTION_VERBOSE);+ SolrCLI.OPTION_ZKHOST_DEPRECATED,+ SolrCLI.OPTION_CREDENTIALS);}private void ensureArgumentIsValidBooleanIfPresent(CommandLine cli, String argName) {@@ -130,8 +131,8 @@ public class AuthTool extends ToolBase {public int runTool(CommandLine cli) throws Exception {SolrCLI.raiseLogLevelUnlessVerbose(cli);- ensureArgumentIsValidBooleanIfPresent(cli, "blockUnknown");- ensureArgumentIsValidBooleanIfPresent(cli, "updateIncludeFileOnly");+ ensureArgumentIsValidBooleanIfPresent(cli, "block-unknown");+ ensureArgumentIsValidBooleanIfPresent(cli, "update-include-file-only");String type = cli.getOptionValue("type", "basicAuth");switch (type) {@@ -149,7 +150,7 @@ public class AuthTool extends ToolBase {private int handleKerberos(CommandLine cli) throws Exception {String cmd = cli.getArgs()[0];boolean updateIncludeFileOnly =- Boolean.parseBoolean(cli.getOptionValue("updateIncludeFileOnly", "false"));+ Boolean.parseBoolean(cli.getOptionValue("update-include-file-only", "false"));String securityJson ="{"+ "\n \"authentication\":{"@@ -219,7 +220,7 @@ public class AuthTool extends ToolBase {StandardCharsets.UTF_8);config = config.replace("\n", "").replace("\r", "");- String solrIncludeFilename = cli.getOptionValue("solrIncludeFile");+ String solrIncludeFilename = cli.getOptionValue("solr-include-file");File includeFile = new File(solrIncludeFilename);if (!includeFile.exists() || !includeFile.canWrite()) {CLIO.out(@@ -237,7 +238,7 @@ public class AuthTool extends ToolBase {case "disable":clearSecurityJson(cli, updateIncludeFileOnly);- solrIncludeFilename = cli.getOptionValue("solrIncludeFile");+ solrIncludeFilename = cli.getOptionValue("solr-include-file");includeFile = new File(solrIncludeFilename);if (!includeFile.exists() || !includeFile.canWrite()) {CLIO.out(@@ -266,18 +267,18 @@ public class AuthTool extends ToolBase {String cmd = cli.getArgs()[0];boolean prompt = Boolean.parseBoolean(cli.getOptionValue("prompt", "false"));boolean updateIncludeFileOnly =- Boolean.parseBoolean(cli.getOptionValue("updateIncludeFileOnly", "false"));+ Boolean.parseBoolean(cli.getOptionValue("update-include-file-only", "false"));switch (cmd) {case "enable":if (!prompt && !cli.hasOption("credentials")) {- CLIO.out("Option -credentials or -prompt is required with enable.");+ CLIO.out("Option --credentials or --prompt is required with enable.");new HelpFormatter().printHelp("bin/solr auth <enable|disable> [OPTIONS]", SolrCLI.getToolOptions(this));SolrCLI.exit(1);} else if (!prompt&& (cli.getOptionValue(SolrCLI.OPTION_CREDENTIALS.getLongOpt()) == null|| !cli.getOptionValue(SolrCLI.OPTION_CREDENTIALS.getLongOpt()).contains(":"))) {- CLIO.out("Option -credentials is not in correct format.");+ CLIO.out("Option --credentials is not in correct format.");new HelpFormatter().printHelp("bin/solr auth <enable|disable> [OPTIONS]", SolrCLI.getToolOptions(this));SolrCLI.exit(1);@@ -289,22 +290,22 @@ public class AuthTool extends ToolBase {try {zkHost = SolrCLI.getZkHost(cli);} catch (Exception ex) {- if (cli.hasOption("zkHost")) {+ if (cli.hasOption("zk-host")) {CLIO.out(- "Couldn't get ZooKeeper host. Please make sure that ZooKeeper is running and the correct zkHost has been passed in.");+ "Couldn't get ZooKeeper host. Please make sure that ZooKeeper is running and the correct zk-host has been passed in.");} else {CLIO.out(- "Couldn't get ZooKeeper host. Please make sure Solr is running in cloud mode, or a zkHost has been passed in.");+ "Couldn't get ZooKeeper host. Please make sure Solr is running in cloud mode, or a zk-host has been passed in.");}SolrCLI.exit(1);}if (zkHost == null) {- if (cli.hasOption("zkHost")) {+ if (cli.hasOption("zk-host")) {CLIO.out(- "Couldn't get ZooKeeper host. Please make sure that ZooKeeper is running and the correct zkHost has been passed in.");+ "Couldn't get ZooKeeper host. Please make sure that ZooKeeper is running and the correct zk-host has been passed in.");} else {CLIO.out(- "Couldn't get ZooKeeper host. Please make sure Solr is running in cloud mode, or a zkHost has been passed in.");+ "Couldn't get ZooKeeper host. Please make sure Solr is running in cloud mode, or a zk-host has been passed in.");}SolrCLI.exit(1);}@@ -333,7 +334,7 @@ public class AuthTool extends ToolBase {} while (password.length() == 0);}- boolean blockUnknown = Boolean.parseBoolean(cli.getOptionValue("blockUnknown", "true"));+ boolean blockUnknown = Boolean.parseBoolean(cli.getOptionValue("block-unknown", "true"));String resourceName = "security.json";final URL resource = SolrCore.class.getClassLoader().getResource(resourceName);@@ -363,7 +364,7 @@ public class AuthTool extends ToolBase {}}- String solrIncludeFilename = cli.getOptionValue("solrIncludeFile");+ String solrIncludeFilename = cli.getOptionValue("solr-include-file");File includeFile = new File(solrIncludeFilename);if (!includeFile.exists() || !includeFile.canWrite()) {CLIO.out(@@ -371,7 +372,7 @@ public class AuthTool extends ToolBase {printAuthEnablingInstructions(username, password);System.exit(0);}- String authConfDir = cli.getOptionValue("authConfDir");+ String authConfDir = cli.getOptionValue("auth-conf-dir");File basicAuthConfFile = new File(authConfDir + File.separator + "basicAuth.conf");if (!basicAuthConfFile.getParentFile().canWrite()) {@@ -400,7 +401,7 @@ public class AuthTool extends ToolBase {case "disable":clearSecurityJson(cli, updateIncludeFileOnly);- solrIncludeFilename = cli.getOptionValue("solrIncludeFile");+ solrIncludeFilename = cli.getOptionValue("solr-include-file");includeFile = new File(solrIncludeFilename);if (!includeFile.exists() || !includeFile.canWrite()) {CLIO.out(diff --git a/solr/core/src/java/org/apache/solr/cli/ClusterTool.java b/solr/core/src/java/org/apache/solr/cli/ClusterTool.javaindex 167df8f0c00..23300bc8800 100644--- a/solr/core/src/java/org/apache/solr/cli/ClusterTool.java+++ b/solr/core/src/java/org/apache/solr/cli/ClusterTool.java@@ -54,19 +54,20 @@ public class ClusterTool extends ToolBase {return List.of(Option.builder().longOpt("property")- .argName("PROP").hasArg()+ .argName("PROPERTY").required(true).desc("Name of the Cluster property to apply the action to, such as: 'urlScheme'.").build(),Option.builder().longOpt("value")- .argName("VALUE").hasArg()+ .argName("VALUE").required(false).desc("Set the property to this value.").build(),- SolrCLI.OPTION_ZKHOST);+ SolrCLI.OPTION_ZKHOST,+ SolrCLI.OPTION_ZKHOST_DEPRECATED);}@Overridediff --git a/solr/core/src/java/org/apache/solr/cli/ConfigSetDownloadTool.java b/solr/core/src/java/org/apache/solr/cli/ConfigSetDownloadTool.javaindex 16fb2bd532f..87ca00c1705 100644--- a/solr/core/src/java/org/apache/solr/cli/ConfigSetDownloadTool.java+++ b/solr/core/src/java/org/apache/solr/cli/ConfigSetDownloadTool.java@@ -43,23 +43,25 @@ public class ConfigSetDownloadTool extends ToolBase {@Overridepublic List<Option> getOptions() {return List.of(- Option.builder("n")- .longOpt("confname")- .argName("NAME")+ Option.builder()+ .longOpt("conf-name").hasArg()+ .argName("NAME").required(true).desc("Configset name in ZooKeeper.").build(),- Option.builder("d")- .longOpt("confdir")- .argName("DIR")+ Option.builder()+ .longOpt("conf-dir").hasArg()+ .argName("DIR").required(true).desc("Local directory with configs.").build(),- SolrCLI.OPTION_ZKHOST,SolrCLI.OPTION_SOLRURL,- SolrCLI.OPTION_VERBOSE);+ SolrCLI.OPTION_SOLRURL_DEPRECATED,+ SolrCLI.OPTION_ZKHOST,+ SolrCLI.OPTION_ZKHOST_DEPRECATED,+ SolrCLI.OPTION_CREDENTIALS);}@Override@@ -74,8 +76,8 @@ public class ConfigSetDownloadTool extends ToolBase {try (SolrZkClient zkClient = SolrCLI.getSolrZkClient(cli, zkHost)) {echoIfVerbose("\nConnecting to ZooKeeper at " + zkHost + " ...", cli);- String confName = cli.getOptionValue("confname");- String confDir = cli.getOptionValue("confdir");+ String confName = cli.getOptionValue("conf-name");+ String confDir = cli.getOptionValue("conf-dir");Path configSetPath = Paths.get(confDir);// we try to be nice about having the "conf" in the directory, and we create it if it's not// there.diff --git a/solr/core/src/java/org/apache/solr/cli/ConfigSetUploadTool.java b/solr/core/src/java/org/apache/solr/cli/ConfigSetUploadTool.javaindex 1ad8ca5d10b..bc0dde9c3f4 100644--- a/solr/core/src/java/org/apache/solr/cli/ConfigSetUploadTool.java+++ b/solr/core/src/java/org/apache/solr/cli/ConfigSetUploadTool.java@@ -19,6 +19,7 @@ package org.apache.solr.cli;import java.io.PrintStream;import java.lang.invoke.MethodHandles;import java.nio.file.Path;+import java.nio.file.Paths;import java.util.List;import org.apache.commons.cli.CommandLine;import org.apache.commons.cli.Option;@@ -45,28 +46,24 @@ public class ConfigSetUploadTool extends ToolBase {public List<Option> getOptions() {return List.of(Option.builder("n")- .longOpt("confname")- .argName("NAME")+ .longOpt("conf-name").hasArg()+ .argName("NAME").required(true).desc("Configset name in ZooKeeper.").build(),Option.builder("d")- .longOpt("confdir")- .argName("DIR")+ .longOpt("conf-dir").hasArg()+ .argName("DIR").required(true).desc("Local directory with configs.").build(),- Option.builder("configsetsDir")- .argName("configsetsDir")- .hasArg()- .required(false)- .desc("Parent directory of example configsets.")- .build(),- SolrCLI.OPTION_ZKHOST,SolrCLI.OPTION_SOLRURL,- SolrCLI.OPTION_VERBOSE);+ SolrCLI.OPTION_SOLRURL_DEPRECATED,+ SolrCLI.OPTION_ZKHOST,+ SolrCLI.OPTION_ZKHOST_DEPRECATED,+ SolrCLI.OPTION_CREDENTIALS);}@Override@@ -79,18 +76,23 @@ public class ConfigSetUploadTool extends ToolBase {SolrCLI.raiseLogLevelUnlessVerbose(cli);String zkHost = SolrCLI.getZkHost(cli);- String confName = cli.getOptionValue("confname");+ final String solrInstallDir = System.getProperty("solr.install.dir");+ Path solrInstallDirPath = Paths.get(solrInstallDir);++ String confName = cli.getOptionValue("conf-name");try (SolrZkClient zkClient = SolrCLI.getSolrZkClient(cli, zkHost)) {echoIfVerbose("\nConnecting to ZooKeeper at " + zkHost + " ...", cli);++ final Path configsetsDirPath = SolrCLI.getConfigSetsDir(solrInstallDirPath);Path confPath =ConfigSetService.getConfigsetPath(- cli.getOptionValue("confdir"), cli.getOptionValue("configsetsDir"));+ cli.getOptionValue("conf-dir"), configsetsDirPath.toString());echo("Uploading "+ confPath.toAbsolutePath()+ " for config "- + cli.getOptionValue("confname")+ + cli.getOptionValue("conf-name")+ " to ZooKeeper at "+ zkHost);FileTypeMagicUtil.assertConfigSetFolderLegal(confPath);diff --git a/solr/core/src/java/org/apache/solr/cli/ConfigTool.java b/solr/core/src/java/org/apache/solr/cli/ConfigTool.javaindex 39ed60697c0..90843ce6fc1 100644--- a/solr/core/src/java/org/apache/solr/cli/ConfigTool.java+++ b/solr/core/src/java/org/apache/solr/cli/ConfigTool.java@@ -58,28 +58,33 @@ public class ConfigTool extends ToolBase {.required(true).desc("Name of the collection.").build(),- Option.builder("action")+ Option.builder("a")+ .longOpt("action").argName("ACTION").hasArg().required(false).desc("Config API action, one of: set-property, unset-property, set-user-property, unset-user-property; default is 'set-property'.").build(),- Option.builder("property")+ Option.builder("p")+ .longOpt("property").argName("PROP").hasArg().required(true).desc("Name of the Config API property to apply the action to, such as: 'updateHandler.autoSoftCommit.maxTime'.").build(),- Option.builder("value")+ Option.builder("v")+ .longOpt("value").argName("VALUE").hasArg().required(false).desc("Set the property to this value; accepts JSON objects and strings.").build(),SolrCLI.OPTION_SOLRURL,+ SolrCLI.OPTION_SOLRURL_DEPRECATED,SolrCLI.OPTION_ZKHOST,+ SolrCLI.OPTION_ZKHOST_DEPRECATED,SolrCLI.OPTION_CREDENTIALS);}diff --git a/solr/core/src/java/org/apache/solr/cli/CreateTool.java b/solr/core/src/java/org/apache/solr/cli/CreateTool.javaindex c1065dfdc88..f828ac77423 100644--- a/solr/core/src/java/org/apache/solr/cli/CreateTool.java+++ b/solr/core/src/java/org/apache/solr/cli/CreateTool.java@@ -27,6 +27,7 @@ import java.util.Map;import java.util.Set;import java.util.concurrent.TimeUnit;import org.apache.commons.cli.CommandLine;+import org.apache.commons.cli.DeprecatedAttributes;import org.apache.commons.cli.Option;import org.apache.commons.io.FileUtils;import org.apache.commons.io.file.PathUtils;@@ -68,32 +69,57 @@ public class CreateTool extends ToolBase {@Overridepublic List<Option> getOptions() {return List.of(- SolrCLI.OPTION_ZKHOST,- SolrCLI.OPTION_SOLRURL,Option.builder("c").longOpt("name")- .argName("NAME").hasArg()+ .argName("NAME").required(true).desc("Name of collection or core to create.").build(),Option.builder("s").longOpt("shards")- .argName("#").hasArg()- .required(false)+ .argName("#").desc("Number of shards; default is 1.").build(),Option.builder("rf")- .longOpt("replicationFactor")+ .longOpt("replication-factor")+ .hasArg().argName("#")+ .desc(+ "Number of copies of each document across the collection (replicas per shard); default is 1.")+ .build(),+ Option.builder()+ .longOpt("replicationFactor")+ .deprecated(+ DeprecatedAttributes.builder()+ .setForRemoval(true)+ .setSince("9.7")+ .setDescription("Use --replication-factor instead")+ .get()).hasArg()+ .argName("#").required(false).desc("Number of copies of each document across the collection (replicas per shard); default is 1.").build(),Option.builder("d")+ .longOpt("conf-dir")+ .argName("DIR")+ .hasArg()+ .desc(+ "Configuration directory to copy when creating the new collection; default is "+ + SolrCLI.DEFAULT_CONFIG_SET+ + '.')+ .build(),+ Option.builder("confdir").longOpt("confdir")+ .deprecated(+ DeprecatedAttributes.builder()+ .setForRemoval(true)+ .setSince("9.7")+ .setDescription("Use --conf-dir instead")+ .get()).argName("DIR").hasArg().required(false)@@ -103,14 +129,30 @@ public class CreateTool extends ToolBase {+ '.').build(),Option.builder("n")+ .longOpt("conf-name")+ .argName("NAME")+ .hasArg()+ .required(false)+ .desc("Configuration name; default is the collection name.")+ .build(),+ Option.builder("confname").longOpt("confname")+ .deprecated(+ DeprecatedAttributes.builder()+ .setForRemoval(true)+ .setSince("9.7")+ .setDescription("Use --conf-name instead")+ .get()).argName("NAME").hasArg().required(false).desc("Configuration name; default is the collection name.").build(),- SolrCLI.OPTION_CREDENTIALS,- SolrCLI.OPTION_VERBOSE);+ SolrCLI.OPTION_SOLRURL,+ SolrCLI.OPTION_SOLRURL_DEPRECATED,+ SolrCLI.OPTION_ZKHOST,+ SolrCLI.OPTION_ZKHOST_DEPRECATED,+ SolrCLI.OPTION_CREDENTIALS);}@Override@@ -128,10 +170,13 @@ public class CreateTool extends ToolBase {protected void createCore(CommandLine cli, SolrClient solrClient) throws Exception {String coreName = cli.getOptionValue("name");- String solrUrl = cli.getOptionValue("solrUrl", SolrCLI.getDefaultSolrUrl());+ String solrUrl = cli.getOptionValue("solr-url", SolrCLI.getDefaultSolrUrl());final String solrInstallDir = System.getProperty("solr.install.dir");- final String confDirName = cli.getOptionValue("confdir", SolrCLI.DEFAULT_CONFIG_SET);+ final String confDirName =+ cli.hasOption("confdir")+ ? cli.getOptionValue("confdir")+ : cli.getOptionValue("conf-dir", SolrCLI.DEFAULT_CONFIG_SET);// we allow them to pass a directory instead of a configset namePath configsetDir = Paths.get(confDirName);@@ -215,8 +260,14 @@ public class CreateTool extends ToolBase {String collectionName = cli.getOptionValue("name");final String solrInstallDir = System.getProperty("solr.install.dir");- String confName = cli.getOptionValue("confname");- String confDir = cli.getOptionValue("confdir", "_default");+ String confName =+ cli.hasOption("conf-name")+ ? cli.getOptionValue("conf-name")+ : cli.getOptionValue("confname");+ String confDir =+ cli.hasOption("confdir")+ ? cli.getOptionValue("confdir")+ : cli.getOptionValue("conf-dir", SolrCLI.DEFAULT_CONFIG_SET);Path solrInstallDirPath = Paths.get(solrInstallDir);Path confDirPath = Paths.get(confDir);ensureConfDirExists(solrInstallDirPath, confDirPath);@@ -228,7 +279,7 @@ public class CreateTool extends ToolBase {"No live nodes found! Cannot create a collection until "+ "there is at least 1 live node in the cluster.");- String solrUrl = cli.getOptionValue("solrUrl");+ String solrUrl = cli.getOptionValue("solr-url");if (solrUrl == null) {String firstLiveNode = liveNodes.iterator().next();solrUrl = ZkStateReader.from(cloudSolrClient).getBaseUrlForNodeName(firstLiveNode);@@ -236,8 +287,13 @@ public class CreateTool extends ToolBase {// build a URL to create the collectionint numShards = Integer.parseInt(cli.getOptionValue("shards", String.valueOf(1)));- int replicationFactor =- Integer.parseInt(cli.getOptionValue("replicationFactor", String.valueOf(1)));+ int replicationFactor = 1;++ if (cli.hasOption("replication-factor")) {+ replicationFactor = Integer.parseInt(cli.getOptionValue("replication-factor"));+ } else if (cli.hasOption("replicationFactor")) {+ replicationFactor = Integer.parseInt(cli.getOptionValue("replicationFactor"));+ }boolean configExistsInZk =confName != null@@ -255,7 +311,7 @@ public class CreateTool extends ToolBase {confName = collectionName;}- final Path configsetsDirPath = getConfigSetsDir(solrInstallDirPath);+ final Path configsetsDirPath = SolrCLI.getConfigSetsDir(solrInstallDirPath);Path confPath = ConfigSetService.getConfigsetPath(confDir, configsetsDirPath.toString());echoIfVerbose(@@ -319,13 +375,8 @@ public class CreateTool extends ToolBase {}}- private Path getConfigSetsDir(Path solrInstallDir) {- Path configSetsPath = Paths.get("server/solr/configsets/");- return solrInstallDir.resolve(configSetsPath);- }-private Path getFullConfDir(Path solrInstallDir, Path confDirName) {- return getConfigSetsDir(solrInstallDir).resolve(confDirName);+ return SolrCLI.getConfigSetsDir(solrInstallDir).resolve(confDirName);}private void ensureConfDirExists(Path solrInstallDir, Path confDirName) {@@ -340,7 +391,10 @@ public class CreateTool extends ToolBase {}private void printDefaultConfigsetWarningIfNecessary(CommandLine cli) {- final String confDirectoryName = cli.getOptionValue("confdir", "_default");+ final String confDirectoryName =+ cli.hasOption("confdir")+ ? cli.getOptionValue("confdir")+ : cli.getOptionValue("conf-dir", SolrCLI.DEFAULT_CONFIG_SET);final String confName = cli.getOptionValue("confname", "");if (confDirectoryName.equals("_default")diff --git a/solr/core/src/java/org/apache/solr/cli/DeleteTool.java b/solr/core/src/java/org/apache/solr/cli/DeleteTool.javaindex 94bfdade677..35b1d8e277f 100644--- a/solr/core/src/java/org/apache/solr/cli/DeleteTool.java+++ b/solr/core/src/java/org/apache/solr/cli/DeleteTool.java@@ -25,6 +25,7 @@ import java.util.Optional;import java.util.Set;import java.util.concurrent.TimeUnit;import org.apache.commons.cli.CommandLine;+import org.apache.commons.cli.DeprecatedAttributes;import org.apache.commons.cli.Option;import org.apache.solr.client.solrj.SolrClient;import org.apache.solr.client.solrj.SolrServerException;@@ -61,7 +62,6 @@ public class DeleteTool extends ToolBase {@Overridepublic List<Option> getOptions() {return List.of(- SolrCLI.OPTION_SOLRURL,Option.builder("c").longOpt("name").argName("NAME")@@ -69,27 +69,56 @@ public class DeleteTool extends ToolBase {.required(true).desc("Name of the core / collection to delete.").build(),- Option.builder("deleteConfig")+ Option.builder("d")+ .longOpt("delete-config")+ .hasArg().argName("true|false")+ .required(false)+ .desc(+ "Flag to indicate if the underlying configuration directory for a collection should also be deleted; default is true.")+ .build(),+ Option.builder()+ .longOpt("deleteConfig")+ .deprecated(+ DeprecatedAttributes.builder()+ .setForRemoval(true)+ .setSince("9.7")+ .setDescription("Use --delete-config instead")+ .get()).hasArg()+ .argName("true|false").required(false).desc("Flag to indicate if the underlying configuration directory for a collection should also be deleted; default is true.").build(),- Option.builder("forceDeleteConfig")+ Option.builder("f")+ .longOpt("force-delete-config").required(false).desc("Skip safety checks when deleting the configuration directory used by a collection.").build(),+ Option.builder()+ .longOpt("forceDeleteConfig")+ .deprecated(+ DeprecatedAttributes.builder()+ .setForRemoval(true)+ .setSince("9.7")+ .setDescription("Use --force-delete-config instead")+ .get())+ .required(false)+ .desc(+ "Skip safety checks when deleting the configuration directory used by a collection.")+ .build(),+ SolrCLI.OPTION_SOLRURL,+ SolrCLI.OPTION_SOLRURL_DEPRECATED,SolrCLI.OPTION_ZKHOST,- SolrCLI.OPTION_CREDENTIALS,- SolrCLI.OPTION_VERBOSE);+ SolrCLI.OPTION_ZKHOST_DEPRECATED,+ SolrCLI.OPTION_CREDENTIALS);}@Overridepublic void runImpl(CommandLine cli) throws Exception {SolrCLI.raiseLogLevelUnlessVerbose(cli);- String solrUrl = SolrCLI.normalizeSolrUrl(cli);try (var solrClient = SolrCLI.getSolrClient(cli)) {if (SolrCLI.isCloudMode(solrClient)) {@@ -132,9 +161,15 @@ public class DeleteTool extends ToolBase {String configName =zkStateReader.getClusterState().getCollection(collectionName).getConfigName();- boolean deleteConfig = "true".equals(cli.getOptionValue("deleteConfig", "true"));+ boolean deleteConfig = true;+ if (cli.hasOption("delete-config")) {+ deleteConfig = "true".equals(cli.getOptionValue("delete-config"));+ } else if (cli.hasOption("deleteConfig")) {+ deleteConfig = "true".equals(cli.getOptionValue("deleteConfig"));+ }+if (deleteConfig && configName != null) {- if (cli.hasOption("forceDeleteConfig")) {+ if (cli.hasOption("force-delete-config") || cli.hasOption("forceDeleteConfig")) {log.warn("Skipping safety checks, configuration directory {} will be deleted with impunity.",configName);@@ -165,7 +200,7 @@ public class DeleteTool extends ToolBase {"Configuration directory {} is also being used by {}{}",configName,inUse.get(),- "; configuration will not be deleted from ZooKeeper. You can pass the -forceDeleteConfig flag to force delete.");+ "; configuration will not be deleted from ZooKeeper. You can pass the --force-delete-config flag to force delete.");}}}diff --git a/solr/core/src/java/org/apache/solr/cli/ExportTool.java b/solr/core/src/java/org/apache/solr/cli/ExportTool.javaindex 694049469d2..901e90e4b7d 100644--- a/solr/core/src/java/org/apache/solr/cli/ExportTool.java+++ b/solr/core/src/java/org/apache/solr/cli/ExportTool.java@@ -97,35 +97,37 @@ public class ExportTool extends ToolBase {public List<Option> getOptions() {return List.of(Option.builder("url")+ .longOpt("solr-collection-url").hasArg()+ .argName("URL").required().desc("Address of the collection, example http://localhost:8983/solr/gettingstarted.").build(),Option.builder("out").hasArg()- .required(false)+ .argName("PATH").desc("Path to output the exported data, and optionally the file name, defaults to 'collection-name'.").build(),Option.builder("format").hasArg()- .required(false)+ .argName("FORMAT").desc("Output format for exported docs (json, jsonl or javabin), defaulting to json.").build(),- Option.builder("compress").required(false).desc("Compress the output.").build(),+ Option.builder("compress").desc("Compress the output.").build(),Option.builder("limit").hasArg()- .required(false)+ .argName("#").desc("Maximum number of docs to download. Default is 100, use -1 for all docs.").build(),Option.builder("query").hasArg()- .required(false)+ .argName("QUERY").desc("A custom query, default is '*:*'.").build(),Option.builder("fields").hasArg()- .required(false)+ .argName("FIELDA,FIELDB").desc("Comma separated list of fields to export. By default all fields are fetched.").build(),SolrCLI.OPTION_CREDENTIALS);@@ -248,7 +250,7 @@ public class ExportTool extends ToolBase {@Overridepublic void runImpl(CommandLine cli) throws Exception {- String url = cli.getOptionValue("url");+ String url = cli.getOptionValue("solr-collection-url");String credentials = cli.getOptionValue(SolrCLI.OPTION_CREDENTIALS.getLongOpt());Info info = new MultiThreadedRunner(url, credentials);info.query = cli.getOptionValue("query", "*:*");diff --git a/solr/core/src/java/org/apache/solr/cli/HealthcheckTool.java b/solr/core/src/java/org/apache/solr/cli/HealthcheckTool.javaindex 4c3d6699c86..1cd06a7a523 100644--- a/solr/core/src/java/org/apache/solr/cli/HealthcheckTool.java+++ b/solr/core/src/java/org/apache/solr/cli/HealthcheckTool.java@@ -56,15 +56,18 @@ public class HealthcheckTool extends ToolBase {@Overridepublic List<Option> getOptions() {return List.of(- SolrCLI.OPTION_SOLRURL,- SolrCLI.OPTION_ZKHOST,Option.builder("c").longOpt("name")- .argName("NAME").hasArg()+ .argName("COLLECTION").required(true).desc("Name of the collection to check.")- .build());+ .build(),+ SolrCLI.OPTION_SOLRURL,+ SolrCLI.OPTION_SOLRURL_DEPRECATED,+ SolrCLI.OPTION_ZKHOST,+ SolrCLI.OPTION_ZKHOST_DEPRECATED,+ SolrCLI.OPTION_CREDENTIALS);}enum ShardState {diff --git a/solr/core/src/java/org/apache/solr/cli/LinkConfigTool.java b/solr/core/src/java/org/apache/solr/cli/LinkConfigTool.javaindex 2d1a41d62b8..f94cd5a2b7f 100644--- a/solr/core/src/java/org/apache/solr/cli/LinkConfigTool.java+++ b/solr/core/src/java/org/apache/solr/cli/LinkConfigTool.java@@ -53,20 +53,21 @@ public class LinkConfigTool extends ToolBase {.desc("Name of the collection to link.").build(),Option.builder("n")- .longOpt("confname")+ .longOpt("conf-name").argName("NAME").hasArg().required(true).desc("Configset name in ZooKeeper.").build(),- SolrCLI.OPTION_ZKHOST);+ SolrCLI.OPTION_ZKHOST,+ SolrCLI.OPTION_ZKHOST_DEPRECATED);}@Overridepublic void runImpl(CommandLine cli) throws Exception {String collection = cli.getOptionValue("name");- String confName = cli.getOptionValue("confname");+ String confName = cli.getOptionValue("conf-name");String zkHost = SolrCLI.getZkHost(cli);try (SolrZkClient zkClient =diff --git a/solr/core/src/java/org/apache/solr/cli/PackageTool.java b/solr/core/src/java/org/apache/solr/cli/PackageTool.javaindex a8bc4131ef4..1765d3f464f 100644--- a/solr/core/src/java/org/apache/solr/cli/PackageTool.java+++ b/solr/core/src/java/org/apache/solr/cli/PackageTool.java@@ -117,8 +117,8 @@ public class PackageTool extends ToolBase {}break;case "list-deployed":- if (cli.hasOption('c')) {- String collection = cli.getArgs()[1];+ if (cli.hasOption("collection")) {+ String collection = cli.getOptionValue("collection");Map<String, SolrPackageInstance> packages =packageManager.getPackagesDeployed(collection);PackageUtils.printGreen("Packages deployed on " + collection + ":");@@ -126,6 +126,9 @@ public class PackageTool extends ToolBase {PackageUtils.printGreen("\t" + packages.get(packageName));}} else {+ // nuance that we use a arg here instead of requiring a --package parameter with a+ // value+ // in this code pathString packageName = cli.getArgs()[1];Map<String, String> deployedCollections =packageManager.getDeployedCollections(packageName);@@ -167,8 +170,8 @@ public class PackageTool extends ToolBase {Pair<String, String> parsedVersion = parsePackageVersion(cli.getArgList().get(1));String packageName = parsedVersion.first();String version = parsedVersion.second();- boolean noprompt = cli.hasOption('y');- boolean isUpdate = cli.hasOption("update") || cli.hasOption('u');+ boolean noprompt = cli.hasOption("no-prompt");+ boolean isUpdate = cli.hasOption("update");String[] collections =cli.hasOption("collections")? PackageUtils.validateCollections(@@ -184,7 +187,7 @@ public class PackageTool extends ToolBase {noprompt);} else {PackageUtils.printRed(- "Either specify -cluster to deploy cluster level plugins or -collections <list-of-collections> to deploy collection level plugins");+ "Either specify --cluster to deploy cluster level plugins or --collections <list-of-collections> to deploy collection level plugins");}break;}@@ -279,7 +282,7 @@ public class PackageTool extends ToolBase {"Uninstall an unused package with specified version from Solr. Both package name and version are required.");print("\n");print(- "Note: (a) Please add '-solrUrl http://host:port' parameter if needed (usually on Windows).");+ "Note: (a) Please add '--solr-url http://host:port' parameter if needed (usually on Windows).");print(" (b) Please make sure that all Solr nodes are started with '-Denable.packages=true' parameter.");print("\n");@@ -308,47 +311,41 @@ public class PackageTool extends ToolBase {@Overridepublic List<Option> getOptions() {return List.of(- SolrCLI.OPTION_SOLRURL,- Option.builder("collections")- .argName("COLLECTIONS")+ Option.builder()+ .longOpt("collections").hasArg()- .required(false)+ .argName("COLLECTIONS").desc("Specifies that this action should affect plugins for the given collections only, excluding cluster level plugins.").build(),- Option.builder("cluster")- .required(false)+ Option.builder()+ .longOpt("cluster").desc("Specifies that this action should affect cluster-level plugins only.").build(),Option.builder("p")- .argName("PARAMS")+ .longOpt("param").hasArgs()- .required(false)+ .argName("PARAMS").desc("List of parameters to be used with deploy command.")- .longOpt("param").build(),- Option.builder("u")- .required(false)- .desc("If a deployment is an update over a previous deployment.")+ Option.builder().longOpt("update")+ .desc("If a deployment is an update over a previous deployment.").build(),Option.builder("c")- .required(false)- .desc("The collection to apply the package to, not required.").longOpt("collection")+ .hasArg()+ .argName("COLLECTION")+ .desc("The collection to apply the package to, not required.").build(),Option.builder("y")- .required(false)+ .longOpt("no-prompt").desc("Don't prompt for input; accept all default choices, defaults to false.")- .longOpt("noprompt").build(),- // u was taken, can we change that instead?- Option.builder("credentials")- .argName("credentials")- .hasArg()- .required(false)- .desc(- "Credentials in the format username:password. Example: --credentials solr:SolrRocks")- .build());+ SolrCLI.OPTION_SOLRURL,+ SolrCLI.OPTION_SOLRURL_DEPRECATED,+ SolrCLI.OPTION_ZKHOST,+ SolrCLI.OPTION_ZKHOST_DEPRECATED,+ SolrCLI.OPTION_CREDENTIALS);}}diff --git a/solr/core/src/java/org/apache/solr/cli/PostLogsTool.java b/solr/core/src/java/org/apache/solr/cli/PostLogsTool.javaindex d46887fe063..458ce6985d6 100644--- a/solr/core/src/java/org/apache/solr/cli/PostLogsTool.java+++ b/solr/core/src/java/org/apache/solr/cli/PostLogsTool.java@@ -65,16 +65,16 @@ public class PostLogsTool extends ToolBase {public List<Option> getOptions() {return List.of(Option.builder("url")- .longOpt("url")- .argName("ADDRESS")+ .longOpt("solr-collection-url").hasArg()+ .argName("ADDRESS").required(true).desc("Address of the collection, example http://localhost:8983/solr/collection1/.").build(),Option.builder("rootdir").longOpt("rootdir")- .argName("DIRECTORY").hasArg()+ .argName("DIRECTORY").required(true).desc("All files found at or below the root directory will be indexed.").build(),diff --git a/solr/core/src/java/org/apache/solr/cli/PostTool.java b/solr/core/src/java/org/apache/solr/cli/PostTool.javaindex 1181910b2a4..93286d427fc 100644--- a/solr/core/src/java/org/apache/solr/cli/PostTool.java+++ b/solr/core/src/java/org/apache/solr/cli/PostTool.java@@ -67,6 +67,7 @@ import javax.xml.xpath.XPathExpression;import javax.xml.xpath.XPathExpressionException;import javax.xml.xpath.XPathFactory;import org.apache.commons.cli.CommandLine;+import org.apache.commons.cli.DeprecatedAttributes;import org.apache.commons.cli.Option;import org.apache.solr.client.api.util.SolrVersion;import org.apache.solr.client.solrj.SolrClient;@@ -86,9 +87,8 @@ public class PostTool extends ToolBase {static final String DATA_MODE_FILES = "files";static final String DATA_MODE_ARGS = "args";static final String DATA_MODE_STDIN = "stdin";- static final String DEFAULT_DATA_MODE = DATA_MODE_FILES;- static final String FORMAT_SOLR = "solr";static final String DATA_MODE_WEB = "web";+ static final String FORMAT_SOLR = "solr";private static final int DEFAULT_WEB_DELAY = 10;private static final int MAX_WEB_DEPTH = 10;@@ -103,7 +103,6 @@ public class PostTool extends ToolBase {OutputStream out = null;String type;String format;- String mode = DEFAULT_DATA_MODE;boolean commit;boolean optimize;boolean dryRun; // Avoids actual network traffic to Solr@@ -172,70 +171,90 @@ public class PostTool extends ToolBase {public List<Option> getOptions() {return List.of(Option.builder("url")- .argName("url").longOpt("solr-update-url").hasArg()- .required(false)+ .argName("UPDATEURL").desc("Solr Update URL, the full url to the update handler, including the /update.").build(),Option.builder("c").longOpt("name")- .argName("NAME").hasArg()+ .argName("NAME").required(false).desc("Name of the collection.").build(),- Option.builder("skipcommit")+ Option.builder()+ .longOpt("skip-commit")+ .required(false)+ .desc("Do not 'commit', and thus changes won't be visible till a commit occurs.")+ .build(),+ Option.builder()+ .longOpt("skipcommit")+ .deprecated(+ DeprecatedAttributes.builder()+ .setForRemoval(true)+ .setSince("9.7")+ .setDescription("Use --skip-commit instead")+ .get()).required(false).desc("Do not 'commit', and thus changes won't be visible till a commit occurs.").build(),- Option.builder("optimize")+ Option.builder("o")+ .longOpt("optimize").required(false).desc("Issue an optimize at end of posting documents.").build(),- Option.builder("mode")+ Option.builder()+ .longOpt("mode")+ .hasArg().argName("mode")- .hasArg(true).required(false).desc(- "Files crawls files, web crawls website, args processes input args, and stdin reads a command from standard in. default: files.")+ "Which mode the Post tool is running in, 'files' crawls local directory, 'web' crawls website, 'args' processes input args, and 'stdin' reads a command from standard in. default: files.").build(),- Option.builder("recursive")+ Option.builder("r")+ .longOpt("recursive")+ .hasArg().argName("recursive")- .hasArg(true).required(false).desc("For web crawl, how deep to go. default: 1").build(),- Option.builder("delay")+ Option.builder("d")+ .longOpt("delay")+ .hasArg().argName("delay")- .hasArg(true).required(false).desc("If recursive then delay will be the wait time between posts. default: 10 for web, 0 for files").build(),- Option.builder("type")+ Option.builder("t")+ .longOpt("type")+ .hasArg().argName("content-type")- .hasArg(true).required(false).desc("Specify a specific mimetype to use, such as application/json.").build(),- Option.builder("filetypes")+ Option.builder("ft")+ .longOpt("filetypes")+ .hasArg().argName("<type>[,<type>,...]")- .hasArg(true).required(false).desc("default: " + DEFAULT_FILE_TYPES).build(),- Option.builder("params")+ Option.builder("p")+ .longOpt("params")+ .hasArg().argName("<key>=<value>[&<key>=<value>...]")- .hasArg(true).required(false).desc("values must be URL-encoded; these pass through to Solr update request.").build(),- Option.builder("out")+ Option.builder()+ .longOpt("out").required(false)- .desc("sends Solr response outputs to console")+ .desc("sends Solr response outputs to console.").build(),- Option.builder("format")+ Option.builder("f")+ .longOpt("format").required(false).desc("sends application/json content as Solr commands to /update instead of /update/json/docs.")@@ -254,24 +273,20 @@ public class PostTool extends ToolBase {SolrCLI.raiseLogLevelUnlessVerbose(cli);solrUpdateUrl = null;- if (cli.hasOption("url")) {- String url = cli.getOptionValue("url");+ if (cli.hasOption("solr-update-url")) {+ String url = cli.getOptionValue("solr-update-url");solrUpdateUrl = new URI(url);- } else if (cli.hasOption("c")) {- String url = SolrCLI.getDefaultSolrUrl() + "/solr/" + cli.getOptionValue("c") + "/update";+ } else if (cli.hasOption("name")) {+ String url = SolrCLI.getDefaultSolrUrl() + "/solr/" + cli.getOptionValue("name") + "/update";solrUpdateUrl = new URI(url);} else {throw new IllegalArgumentException(- "Must specify either -url or -c parameter to post documents.");+ "Must specify either --solr-update-url or -c parameter to post documents.");}- if (cli.hasOption("mode")) {- mode = cli.getOptionValue("mode");- }+ String mode = cli.getOptionValue("mode", DATA_MODE_FILES);- if (cli.hasOption("dry-run")) {- dryRun = true;- }+ dryRun = cli.hasOption("dry-run");if (cli.hasOption("type")) {type = cli.getOptionValue("type");@@ -289,21 +304,21 @@ public class PostTool extends ToolBase {recursive = Integer.parseInt(cli.getOptionValue("recursive", "1"));out = cli.hasOption("out") ? CLIO.getOutStream() : null;- commit = cli.hasOption("skipcommit") ? false : true;+ commit = !(cli.hasOption("skipcommit") || cli.hasOption("skip-commit"));optimize = cli.hasOption("optimize");credentials = cli.getOptionValue(SolrCLI.OPTION_CREDENTIALS.getLongOpt());args = cli.getArgs();- execute();+ execute(mode);}/*** After initialization, call execute to start the post job. This method delegates to the correct* mode method.*/- public void execute() throws SolrServerException, IOException {+ public void execute(String mode) throws SolrServerException, IOException {final RTimer timer = new RTimer();if (PostTool.DATA_MODE_FILES.equals(mode)) {doFilesMode();@@ -360,11 +375,11 @@ public class PostTool extends ToolBase {private void doWebMode() {reset();- int numPagesPosted = 0;+ int numPagesPosted;try {if (type != null) {throw new IllegalArgumentException(- "Specifying content-type with \"-Ddata=web\" is not supported");+ "Specifying content-type with \"--mode=web\" is not supported");}// Set Extracting handler as default@@ -767,17 +782,23 @@ public class PostTool extends ToolBase {*/public static String appendParam(String url, String param) {String[] pa = param.split("&");+ StringBuilder urlBuilder = new StringBuilder(url);for (String p : pa) {if (p.trim().length() == 0) {continue;}String[] kv = p.split("=");if (kv.length == 2) {- url = url + (url.contains("?") ? "&" : "?") + kv[0] + "=" + kv[1];+ urlBuilder+ .append(urlBuilder.toString().contains("?") ? "&" : "?")+ .append(kv[0])+ .append("=")+ .append(kv[1]);} else {warn("Skipping param " + p + " which is not on form key=value");}}+ url = urlBuilder.toString();return url;}@@ -1083,8 +1104,7 @@ public class PostTool extends ToolBase {public static Document makeDom(byte[] in)throws SAXException, IOException, ParserConfigurationException {InputStream is = new ByteArrayInputStream(in);- Document dom = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(is);- return dom;+ return DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(is);}/** Inner class to filter files based on glob wildcards */diff --git a/solr/core/src/java/org/apache/solr/cli/RunExampleTool.java b/solr/core/src/java/org/apache/solr/cli/RunExampleTool.javaindex 73ff1dd8772..d9fc740ddcd 100644--- a/solr/core/src/java/org/apache/solr/cli/RunExampleTool.java+++ b/solr/core/src/java/org/apache/solr/cli/RunExampleTool.java@@ -36,6 +36,7 @@ import java.util.Scanner;import java.util.Set;import java.util.concurrent.TimeUnit;import org.apache.commons.cli.CommandLine;+import org.apache.commons.cli.DeprecatedAttributes;import org.apache.commons.cli.Option;import org.apache.commons.exec.DefaultExecuteResultHandler;import org.apache.commons.exec.DefaultExecutor;@@ -93,7 +94,20 @@ public class RunExampleTool extends ToolBase {@Overridepublic List<Option> getOptions() {return List.of(- Option.builder("noprompt")+ Option.builder("n")+ .longOpt("no-prompt")+ .required(false)+ .desc(+ "Don't prompt for input; accept all defaults when running examples that accept user input.")+ .build(),+ Option.builder()+ .longOpt("noprompt")+ .deprecated(+ DeprecatedAttributes.builder()+ .setForRemoval(true)+ .setSince("9.7")+ .setDescription("Use --no-prompt instead")+ .get()).required(false).desc("Don't prompt for input; accept all defaults when running examples that accept user input.")@@ -105,7 +119,8 @@ public class RunExampleTool extends ToolBase {.desc("Name of the example to launch, one of: cloud, techproducts, schemaless, films.").longOpt("example").build(),- Option.builder("script")+ Option.builder("s")+ .longOpt("script").argName("PATH").hasArg().required(false)@@ -116,20 +131,23 @@ public class RunExampleTool extends ToolBase {.hasArg().required(true).desc("Path to the Solr server directory.")- .longOpt("serverDir")+ .longOpt("server-dir").build(),- Option.builder("force")+ Option.builder("f")+ .longOpt("force").argName("FORCE").desc("Force option in case Solr is run as root.").build(),- Option.builder("exampleDir")+ Option.builder()+ .longOpt("example-dir").argName("DIR").hasArg().required(false).desc("Path to the Solr example directory; if not provided, ${serverDir}/../example is expected to exist.").build(),- Option.builder("urlScheme")+ Option.builder()+ .longOpt("url-scheme").argName("SCHEME").hasArg().required(false)@@ -149,13 +167,6 @@ public class RunExampleTool extends ToolBase {.desc("Specify the hostname for this Solr instance.").longOpt("host").build(),- Option.builder("z")- .argName("ZKHOST")- .hasArg()- .required(false)- .desc("ZooKeeper connection string; only used when running in SolrCloud mode using -c.")- .longOpt("zkhost")- .build(),Option.builder("c").required(false).desc(@@ -177,17 +188,19 @@ public class RunExampleTool extends ToolBase {.desc("Additional options to be passed to the JVM when starting example Solr server(s).").longOpt("addlopts")- .build());+ .build(),+ SolrCLI.OPTION_ZKHOST,+ SolrCLI.OPTION_ZKHOST_DEPRECATED);}@Overridepublic void runImpl(CommandLine cli) throws Exception {- this.urlScheme = cli.getOptionValue("urlScheme", "http");+ this.urlScheme = cli.getOptionValue("url-scheme", "http");- serverDir = new File(cli.getOptionValue("serverDir"));+ serverDir = new File(cli.getOptionValue("server-dir"));if (!serverDir.isDirectory())throw new IllegalArgumentException(- "Value of -serverDir option is invalid! "+ "Value of --server-dir option is invalid! "+ serverDir.getAbsolutePath()+ " is not a directory!");@@ -195,7 +208,7 @@ public class RunExampleTool extends ToolBase {if (script != null) {if (!(new File(script)).isFile())throw new IllegalArgumentException(- "Value of -script option is invalid! " + script + " not found");+ "Value of --script option is invalid! " + script + " not found");} else {File scriptFile = new File(serverDir.getParentFile(), "bin/solr");if (scriptFile.isFile()) {@@ -206,18 +219,18 @@ public class RunExampleTool extends ToolBase {script = scriptFile.getAbsolutePath();} else {throw new IllegalArgumentException(- "Cannot locate the bin/solr script! Please pass -script to this application.");+ "Cannot locate the bin/solr script! Please pass --script to this application.");}}}exampleDir =- (cli.hasOption("exampleDir"))- ? new File(cli.getOptionValue("exampleDir"))+ (cli.hasOption("example-dir"))+ ? new File(cli.getOptionValue("example-dir")): new File(serverDir.getParent(), "example");if (!exampleDir.isDirectory())throw new IllegalArgumentException(- "Value of -exampleDir option is invalid! "+ "Value of --example-dir option is invalid! "+ exampleDir.getAbsolutePath()+ " is not a directory!");@@ -264,7 +277,7 @@ public class RunExampleTool extends ToolBase {String solrUrl = (String) nodeStatus.get("baseUrl");- // If the example already exists then let the user know they should delete it or+ // If the example already exists then let the user know they should delete it, or// they may get unusual behaviors.boolean alreadyExists = false;boolean cloudMode = nodeStatus.get("cloud") != null;@@ -299,13 +312,12 @@ public class RunExampleTool extends ToolBase {if (!alreadyExists) {String[] createArgs =new String[] {- "-name", collectionName,- "-shards", "1",- "-replicationFactor", "1",- "-confname", collectionName,- "-confdir", configSet,- "-configsetsDir", configsetsDir.getAbsolutePath(),- "-solrUrl", solrUrl+ "--name", collectionName,+ "--shards", "1",+ "--replication-factor", "1",+ "--conf-name", collectionName,+ "--conf-dir", configSet,+ "--solr-url", solrUrl};CreateTool createTool = new CreateTool(stdout);int createCode =@@ -334,9 +346,9 @@ public class RunExampleTool extends ToolBase {String[] args =new String[] {"post",- "-url",+ "--solr-update-url",updateUrl,- "-type",+ "--type","application/xml",exampledocsDir.getAbsolutePath() + "/*.xml"};@@ -416,9 +428,9 @@ public class RunExampleTool extends ToolBase {String[] args =new String[] {"post",- "-url",+ "--solr-update-url",updateUrl,- "-type",+ "--type","application/json",filmsJsonFile.getAbsolutePath()};@@ -442,7 +454,7 @@ public class RunExampleTool extends ToolBase {protected void runCloudExample(CommandLine cli) throws Exception {- boolean prompt = !cli.hasOption("noprompt");+ boolean prompt = !(cli.hasOption("no-prompt") || cli.hasOption("noprompt"));int numNodes = 2;int[] cloudPorts = new int[] {8983, 7574, 8984, 7575};int defaultPort =@@ -608,8 +620,8 @@ public class RunExampleTool extends ToolBase {String hostArg = (host != null && !"localhost".equals(host)) ? " -h " + host : "";String zkHostArg = (zkHost != null) ? " -z " + zkHost : "";String memArg = (memory != null) ? " -m " + memory : "";- String cloudModeArg = cloudMode ? "-cloud " : "";- String forceArg = cli.hasOption("force") ? " -force" : "";+ String cloudModeArg = cloudMode ? "--cloud " : "";+ String forceArg = cli.hasOption("force") ? " --force" : "";String verboseArg = verbose ? "-V" : "";String addlOpts = cli.getOptionValue('a');@@ -854,13 +866,12 @@ public class RunExampleTool extends ToolBase {// invoke the CreateToolString[] createArgs =new String[] {- "-name", collectionName,- "-shards", String.valueOf(numShards),- "-replicationFactor", String.valueOf(replicationFactor),- "-confname", collectionName,- "-confdir", cloudConfig,- "-configsetsDir", configsetsDir.getAbsolutePath(),- "-solrUrl", solrUrl+ "--name", collectionName,+ "--shards", String.valueOf(numShards),+ "--replication-factor", String.valueOf(replicationFactor),+ "--conf-name", collectionName,+ "--conf-dir", cloudConfig,+ "--solr-url", solrUrl};CreateTool createTool = new CreateTool(stdout);@@ -914,12 +925,12 @@ public class RunExampleTool extends ToolBase {File solrXml = new File(serverDir, "solr/solr.xml");if (!solrXml.isFile())throw new IllegalArgumentException(- "Value of -serverDir option is invalid! " + solrXml.getAbsolutePath() + " not found!");+ "Value of --server-dir option is invalid! " + solrXml.getAbsolutePath() + " not found!");File zooCfg = new File(serverDir, "solr/zoo.cfg");if (!zooCfg.isFile())throw new IllegalArgumentException(- "Value of -serverDir option is invalid! " + zooCfg.getAbsolutePath() + " not found!");+ "Value of --server-dir option is invalid! " + zooCfg.getAbsolutePath() + " not found!");File solrHomeDir = new File(exampleParentDir, dirName + "/solr");if (!solrHomeDir.isDirectory()) {diff --git a/solr/core/src/java/org/apache/solr/cli/SolrCLI.java b/solr/core/src/java/org/apache/solr/cli/SolrCLI.javaindex 93fdbf3697c..f422586aaee 100755--- a/solr/core/src/java/org/apache/solr/cli/SolrCLI.java+++ b/solr/core/src/java/org/apache/solr/cli/SolrCLI.java@@ -30,6 +30,8 @@ import java.lang.invoke.MethodHandles;import java.net.SocketException;import java.net.URI;import java.net.URL;+import java.nio.file.Path;+import java.nio.file.Paths;import java.util.ArrayList;import java.util.Arrays;import java.util.Collections;@@ -45,6 +47,7 @@ import java.util.zip.ZipEntry;import java.util.zip.ZipInputStream;import org.apache.commons.cli.CommandLine;import org.apache.commons.cli.DefaultParser;+import org.apache.commons.cli.DeprecatedAttributes;import org.apache.commons.cli.HelpFormatter;import org.apache.commons.cli.Option;import org.apache.commons.cli.Options;@@ -81,9 +84,27 @@ public class SolrCLI implements CLIO {public static final String ZK_HOST = "localhost:9983";+ public static final Option OPTION_ZKHOST_DEPRECATED =+ Option.builder("zkHost")+ .longOpt("zkHost")+ .deprecated(+ DeprecatedAttributes.builder()+ .setForRemoval(true)+ .setSince("9.7")+ .setDescription("Use --zk-host instead")+ .get())+ .argName("HOST")+ .hasArg()+ .required(false)+ .desc(+ "Zookeeper connection string; unnecessary if ZK_HOST is defined in solr.in.sh; otherwise, defaults to "+ + ZK_HOST+ + '.')+ .build();+public static final Option OPTION_ZKHOST =Option.builder("z")- .longOpt("zkHost")+ .longOpt("zk-host").argName("HOST").hasArg().required(false)@@ -91,20 +112,43 @@ public class SolrCLI implements CLIO {"Zookeeper connection string; unnecessary if ZK_HOST is defined in solr.in.sh; otherwise, defaults to "+ ZK_HOST+ '.')- .longOpt("zkHost").build();- public static final Option OPTION_SOLRURL =+ public static final Option OPTION_SOLRURL_DEPRECATED =Option.builder("solrUrl")+ .longOpt("solrUrl")+ .deprecated(+ DeprecatedAttributes.builder()+ .setForRemoval(true)+ .setSince("9.7")+ .setDescription("Use --solr-url instead")+ .get()).argName("HOST").hasArg().required(false).desc(- "Base Solr URL, which can be used to determine the zkHost if that's not known; defaults to: "+ "Base Solr URL, which can be used to determine the zk-host if that's not known; defaults to: "+ + getDefaultSolrUrl()+ + '.')+ .build();+ public static final Option OPTION_SOLRURL =+ Option.builder("url")+ .longOpt("solr-url")+ .argName("HOST")+ .hasArg()+ .required(false)+ .desc(+ "Base Solr URL, which can be used to determine the zk-host if that's not known; defaults to: "+ getDefaultSolrUrl()+ '.').build();public static final Option OPTION_VERBOSE =- Option.builder("verbose").required(false).desc("Enable more verbose command output.").build();+ Option.builder("v")+ .longOpt("verbose")+ .required(false)+ .desc("Enable verbose command output.")+ .build();+ public static final Option OPTION_HELP =+ Option.builder("h").longOpt("help").required(false).desc("Print this message.").build();// should this be boolean or just an option?public static final Option OPTION_RECURSE =@@ -276,7 +320,7 @@ public class SolrCLI implements CLIO {public static Options getToolOptions(Tool tool) {Options options = new Options();- options.addOption("help", false, "Print this message");+ options.addOption(OPTION_HELP);options.addOption(OPTION_VERBOSE);List<Option> toolOpts = tool.getOptions();for (Option toolOpt : toolOpts) {@@ -290,7 +334,7 @@ public class SolrCLI implements CLIO {String toolName, List<Option> customOptions, String[] args) {Options options = new Options();- options.addOption("help", false, "Print this message");+ options.addOption(OPTION_HELP);options.addOption(OPTION_VERBOSE);if (customOptions != null) {@@ -307,7 +351,7 @@ public class SolrCLI implements CLIO {boolean hasHelpArg = false;if (args != null) {for (String arg : args) {- if ("-h".equals(arg) || "-help".equals(arg)) {+ if ("-h".equals(arg) || "--help".equals(arg) || "-help".equals(arg)) {hasHelpArg = true;break;}@@ -317,7 +361,7 @@ public class SolrCLI implements CLIO {CLIO.err("Failed to parse command-line arguments due to: " + exp.getMessage());exit(1);} else {- HelpFormatter formatter = new HelpFormatter();+ HelpFormatter formatter = HelpFormatter.builder().setShowDeprecated(true).get();formatter.printHelp(toolName, options);exit(0);}@@ -499,8 +543,8 @@ public class SolrCLI implements CLIO {print(" Omit '-z localhost:2181' from the above command if you have defined ZK_HOST in solr.in.sh.");print("");- print("Pass -help or -h after any COMMAND to see command-specific usage information,");- print("such as: ./solr start -help or ./solr stop -h");+ print("Pass --help or -h after any COMMAND to see command-specific usage information,");+ print("such as: ./solr start --help or ./solr stop -h");}/**@@ -544,18 +588,20 @@ public class SolrCLI implements CLIO {}/**- * Get the base URL of a live Solr instance from either the solrUrl command-line option or from+ * Get the base URL of a live Solr instance from either the --solr-url command-line option or from* ZooKeeper.*/public static String normalizeSolrUrl(CommandLine cli) throws Exception {- String solrUrl = cli.getOptionValue("solrUrl");+ String solrUrl =+ cli.hasOption("solr-url") ? cli.getOptionValue("solr-url") : cli.getOptionValue("solrUrl");if (solrUrl == null) {- String zkHost = cli.getOptionValue("zkHost");+ String zkHost =+ cli.hasOption("zk-host") ? cli.getOptionValue("zk-host") : cli.getOptionValue("zkHost");if (zkHost == null) {solrUrl = SolrCLI.getDefaultSolrUrl();CLIO.getOutStream().println(- "Neither -zkHost or -solrUrl parameters provided so assuming solrUrl is "+ "Neither --zk-host or --solr-url parameters provided so assuming solr url is "+ solrUrl+ ".");} else {@@ -578,12 +624,13 @@ public class SolrCLI implements CLIO {}/**- * Get the ZooKeeper connection string from either the zkHost command-line option or by looking it- * up from a running Solr instance based on the solrUrl option.+ * Get the ZooKeeper connection string from either the zk-host command-line option or by looking+ * it up from a running Solr instance based on the solr-url option.*/public static String getZkHost(CommandLine cli) throws Exception {- String zkHost = cli.getOptionValue("zkHost");+ String zkHost =+ cli.hasOption("zk-host") ? cli.getOptionValue("zk-host") : cli.getOptionValue("zkHost");if (zkHost != null && !zkHost.isBlank()) {return zkHost;}@@ -686,4 +733,9 @@ public class SolrCLI implements CLIO {solrClient.request(new GenericSolrRequest(SolrRequest.METHOD.GET, SYSTEM_INFO_PATH));return "solrcloud".equals(systemInfo.get("mode"));}++ public static Path getConfigSetsDir(Path solrInstallDir) {+ Path configSetsPath = Paths.get("server/solr/configsets/");+ return solrInstallDir.resolve(configSetsPath);+ }}diff --git a/solr/core/src/java/org/apache/solr/cli/StatusTool.java b/solr/core/src/java/org/apache/solr/cli/StatusTool.javaindex 840539c69c4..dd9a579266e 100644--- a/solr/core/src/java/org/apache/solr/cli/StatusTool.java+++ b/solr/core/src/java/org/apache/solr/cli/StatusTool.java@@ -57,7 +57,8 @@ public class StatusTool extends ToolBase {}public static final Option OPTION_MAXWAITSECS =- Option.builder("maxWaitSecs")+ Option.builder()+ .longOpt("max-wait-secs").argName("SECS").hasArg().required(false)@@ -67,10 +68,12 @@ public class StatusTool extends ToolBase {@Overridepublic List<Option> getOptions() {return List.of(- // The solrUrl option is not exposed to the end user, and is- // created by the bin/solr script and passed into this too.- Option.builder("solrUrl")+ // The solr-url option is not exposed to the end user, and is+ // created by the bin/solr script and passed into this command directly,+ // therefore we don't use the SolrCLI.OPTION_SOLRURL.+ Option.builder().argName("URL")+ .longOpt("solr-url").hasArg().required(false).desc("Property set by calling scripts, not meant for user configuration.")@@ -91,7 +94,7 @@ public class StatusTool extends ToolBase {return;}- int maxWaitSecs = Integer.parseInt(cli.getOptionValue("maxWaitSecs", "0"));+ int maxWaitSecs = Integer.parseInt(cli.getOptionValue("max-wait-secs", "0"));String solrUrl = SolrCLI.normalizeSolrUrl(cli);if (maxWaitSecs > 0) {int solrPort = new URI(solrUrl).getPort();diff --git a/solr/core/src/java/org/apache/solr/cli/UpdateACLTool.java b/solr/core/src/java/org/apache/solr/cli/UpdateACLTool.javaindex 53f29b41b56..66804cecb48 100644--- a/solr/core/src/java/org/apache/solr/cli/UpdateACLTool.java+++ b/solr/core/src/java/org/apache/solr/cli/UpdateACLTool.java@@ -57,7 +57,8 @@ public class UpdateACLTool extends ToolBase {.required(true).desc("The path to update.").build(),- SolrCLI.OPTION_ZKHOST);+ SolrCLI.OPTION_ZKHOST,+ SolrCLI.OPTION_ZKHOST_DEPRECATED);}@Overridediff --git a/solr/core/src/java/org/apache/solr/cli/ZkCpTool.java b/solr/core/src/java/org/apache/solr/cli/ZkCpTool.javaindex 095588e9d60..fcac11dbc00 100644--- a/solr/core/src/java/org/apache/solr/cli/ZkCpTool.java+++ b/solr/core/src/java/org/apache/solr/cli/ZkCpTool.java@@ -53,15 +53,17 @@ public class ZkCpTool extends ToolBase {@Overridepublic List<Option> getOptions() {return List.of(- Option.builder("src")- .argName("src")+ Option.builder()+ .longOpt("source").hasArg()+ .argName("SRC").required(true).desc("Source file or directory, may be local or a Znode.").build(),- Option.builder("dst")- .argName("dst")+ Option.builder()+ .longOpt("destination").hasArg()+ .argName("DST").required(true).desc("Destination of copy, may be local or a Znode.").build(),@@ -73,9 +75,11 @@ public class ZkCpTool extends ToolBase {.desc("Required to look up configuration for compressing state.json.").build(),SolrCLI.OPTION_RECURSE,- SolrCLI.OPTION_ZKHOST,SolrCLI.OPTION_SOLRURL,- SolrCLI.OPTION_VERBOSE);+ SolrCLI.OPTION_SOLRURL_DEPRECATED,+ SolrCLI.OPTION_ZKHOST,+ SolrCLI.OPTION_ZKHOST_DEPRECATED,+ SolrCLI.OPTION_CREDENTIALS);}@Override@@ -89,8 +93,8 @@ public class ZkCpTool extends ToolBase {String zkHost = SolrCLI.getZkHost(cli);echoIfVerbose("\nConnecting to ZooKeeper at " + zkHost + " ...", cli);- String src = cli.getOptionValue("src");- String dst = cli.getOptionValue("dst");+ String src = cli.getOptionValue("source");+ String dst = cli.getOptionValue("destination");Boolean recurse = Boolean.parseBoolean(cli.getOptionValue("recurse"));echo("Copying from '" + src + "' to '" + dst + "'. ZooKeeper at " + zkHost);diff --git a/solr/core/src/java/org/apache/solr/cli/ZkLsTool.java b/solr/core/src/java/org/apache/solr/cli/ZkLsTool.javaindex 9e406040e4a..dfd004ef7df 100644--- a/solr/core/src/java/org/apache/solr/cli/ZkLsTool.java+++ b/solr/core/src/java/org/apache/solr/cli/ZkLsTool.java@@ -40,15 +40,19 @@ public class ZkLsTool extends ToolBase {@Overridepublic List<Option> getOptions() {return List.of(- Option.builder("path")- .argName("path")+ Option.builder()+ .longOpt("path")+ .argName("PATH").hasArg().required(true).desc("Path to list.").build(),SolrCLI.OPTION_RECURSE,- SolrCLI.OPTION_ZKHOST,SolrCLI.OPTION_SOLRURL,+ SolrCLI.OPTION_SOLRURL_DEPRECATED,+ SolrCLI.OPTION_ZKHOST,+ SolrCLI.OPTION_ZKHOST_DEPRECATED,+ SolrCLI.OPTION_CREDENTIALS,SolrCLI.OPTION_VERBOSE);}diff --git a/solr/core/src/java/org/apache/solr/cli/ZkMkrootTool.java b/solr/core/src/java/org/apache/solr/cli/ZkMkrootTool.javaindex 72856ae1325..436eb93de27 100644--- a/solr/core/src/java/org/apache/solr/cli/ZkMkrootTool.java+++ b/solr/core/src/java/org/apache/solr/cli/ZkMkrootTool.java@@ -47,14 +47,18 @@ public class ZkMkrootTool extends ToolBase {.required(true).desc("Path to create.").build(),- Option.builder()+ Option.builder() // This appears not to be wired into bin/solr commands..longOpt("fail-on-exists").hasArg().required(false).desc("Raise an error if the root exists. Defaults to false.").build(),- SolrCLI.OPTION_ZKHOST,+ SolrCLI.OPTION_RECURSE,SolrCLI.OPTION_SOLRURL,+ SolrCLI.OPTION_SOLRURL_DEPRECATED,+ SolrCLI.OPTION_ZKHOST,+ SolrCLI.OPTION_ZKHOST_DEPRECATED,+ SolrCLI.OPTION_CREDENTIALS,SolrCLI.OPTION_VERBOSE);}diff --git a/solr/core/src/java/org/apache/solr/cli/ZkMvTool.java b/solr/core/src/java/org/apache/solr/cli/ZkMvTool.javaindex aab57416b6b..00a159a70bd 100644--- a/solr/core/src/java/org/apache/solr/cli/ZkMvTool.java+++ b/solr/core/src/java/org/apache/solr/cli/ZkMvTool.java@@ -42,20 +42,26 @@ public class ZkMvTool extends ToolBase {@Overridepublic List<Option> getOptions() {return List.of(- Option.builder("src")- .argName("src")+ Option.builder()+ .argName("SRC")+ .longOpt("source").hasArg().required(true).desc("Source Znode to move from.").build(),- Option.builder("dst")- .argName("dst")+ Option.builder()+ .argName("DST")+ .longOpt("destination").hasArg().required(true).desc("Destination Znode to move to.").build(),- SolrCLI.OPTION_ZKHOST,+ SolrCLI.OPTION_RECURSE,SolrCLI.OPTION_SOLRURL,+ SolrCLI.OPTION_SOLRURL_DEPRECATED,+ SolrCLI.OPTION_ZKHOST,+ SolrCLI.OPTION_ZKHOST_DEPRECATED,+ SolrCLI.OPTION_CREDENTIALS,SolrCLI.OPTION_VERBOSE);}@@ -71,8 +77,8 @@ public class ZkMvTool extends ToolBase {try (SolrZkClient zkClient = SolrCLI.getSolrZkClient(cli, zkHost)) {echoIfVerbose("\nConnecting to ZooKeeper at " + zkHost + " ...", cli);- String src = cli.getOptionValue("src");- String dst = cli.getOptionValue("dst");+ String src = cli.getOptionValue("source");+ String dst = cli.getOptionValue("destination");if (src.toLowerCase(Locale.ROOT).startsWith("file:")|| dst.toLowerCase(Locale.ROOT).startsWith("file:")) {diff --git a/solr/core/src/java/org/apache/solr/cli/ZkRmTool.java b/solr/core/src/java/org/apache/solr/cli/ZkRmTool.javaindex 1be8c6492a4..b00b769e33d 100644--- a/solr/core/src/java/org/apache/solr/cli/ZkRmTool.java+++ b/solr/core/src/java/org/apache/solr/cli/ZkRmTool.java@@ -42,15 +42,19 @@ public class ZkRmTool extends ToolBase {@Overridepublic List<Option> getOptions() {return List.of(- Option.builder("path")- .argName("path")+ Option.builder()+ .longOpt("path")+ .argName("PATH").hasArg().required(true).desc("Path to remove.").build(),SolrCLI.OPTION_RECURSE,- SolrCLI.OPTION_ZKHOST,SolrCLI.OPTION_SOLRURL,+ SolrCLI.OPTION_SOLRURL_DEPRECATED,+ SolrCLI.OPTION_ZKHOST,+ SolrCLI.OPTION_ZKHOST_DEPRECATED,+ SolrCLI.OPTION_CREDENTIALS,SolrCLI.OPTION_VERBOSE);}diff --git a/solr/core/src/test/org/apache/solr/cli/AuthToolTest.java b/solr/core/src/test/org/apache/solr/cli/AuthToolTest.javaindex cb2d5caff4d..a91a4577ba6 100644--- a/solr/core/src/test/org/apache/solr/cli/AuthToolTest.java+++ b/solr/core/src/test/org/apache/solr/cli/AuthToolTest.java@@ -64,15 +64,15 @@ public class AuthToolTest extends SolrCloudTestCase {String[] args = {"auth","enable",- "-zkHost",+ "-z",cluster.getZkClient().getZkServerAddress(),- "-authConfDir",+ "--auth-conf-dir",dir.toAbsolutePath().toString(),- "-solrIncludeFile",+ "--solr-include-file",solrIncludeFile.toAbsolutePath().toString(),"-credentials","solr:solr",- "-blockUnknown",+ "--block-unknown","true"};assertEquals(0, runTool(args));diff --git a/solr/core/src/test/org/apache/solr/cli/CreateToolTest.java b/solr/core/src/test/org/apache/solr/cli/CreateToolTest.javaindex 4ff1028520e..e0ee7807533 100644--- a/solr/core/src/test/org/apache/solr/cli/CreateToolTest.java+++ b/solr/core/src/test/org/apache/solr/cli/CreateToolTest.java@@ -47,7 +47,7 @@ public class CreateToolTest extends SolrCloudTestCase {collectionName,"-n","cloud-minimal",- "-zkHost",+ "-z",cluster.getZkClient().getZkServerAddress(),"-credentials",SecurityJson.USER_PASS,diff --git a/solr/core/src/test/org/apache/solr/cli/DeleteToolTest.java b/solr/core/src/test/org/apache/solr/cli/DeleteToolTest.javaindex 7c781f2e636..59e1d6a7fe2 100644--- a/solr/core/src/test/org/apache/solr/cli/DeleteToolTest.java+++ b/solr/core/src/test/org/apache/solr/cli/DeleteToolTest.java@@ -60,9 +60,9 @@ public class DeleteToolTest extends SolrCloudTestCase {"delete","-c","testDeleteCollectionWithBasicAuth",- "-deleteConfig",+ "--delete-config","false",- "-zkHost",+ "-z",cluster.getZkClient().getZkServerAddress(),"-credentials",SecurityJson.USER_PASS,@@ -87,7 +87,7 @@ public class DeleteToolTest extends SolrCloudTestCase {"delete","-c","testFailsToDeleteProtectedCollection",- "-zkHost",+ "-z",cluster.getZkClient().getZkServerAddress(),"-verbose"};diff --git a/solr/core/src/test/org/apache/solr/cli/HealthcheckToolTest.java b/solr/core/src/test/org/apache/solr/cli/HealthcheckToolTest.javaindex a7d8e7150eb..088346aa383 100644--- a/solr/core/src/test/org/apache/solr/cli/HealthcheckToolTest.java+++ b/solr/core/src/test/org/apache/solr/cli/HealthcheckToolTest.java@@ -47,9 +47,7 @@ public class HealthcheckToolTest extends SolrCloudTestCase {public void testHealthcheckWithZkHostParameter() throws Exception {String[] args =- new String[] {- "healthcheck", "-c", "bob", "-zkHost", cluster.getZkClient().getZkServerAddress()- };+ new String[] {"healthcheck", "-c", "bob", "-z", cluster.getZkClient().getZkServerAddress()};assertEquals(0, runTool(args));}@@ -61,7 +59,7 @@ public class HealthcheckToolTest extends SolrCloudTestCase {String solrUrl =ZkStateReader.from(cluster.getSolrClient()).getBaseUrlForNodeName(firstLiveNode);- String[] args = new String[] {"healthcheck", "-c", "bob", "-solrUrl", solrUrl};+ String[] args = new String[] {"healthcheck", "-c", "bob", "--solr-url", solrUrl};assertEquals(0, runTool(args));}@@ -75,7 +73,7 @@ public class HealthcheckToolTest extends SolrCloudTestCase {solrUrl = solrUrl.substring(0, solrUrl.indexOf("/solr"));- String[] args = new String[] {"healthcheck", "-c", "bob", "-solrUrl", solrUrl};+ String[] args = new String[] {"healthcheck", "-c", "bob", "--solr-url", solrUrl};assertEquals(0, runTool(args));}diff --git a/solr/core/src/test/org/apache/solr/cli/PackageToolTest.java b/solr/core/src/test/org/apache/solr/cli/PackageToolTest.javaindex c638d980101..7a6774017f2 100644--- a/solr/core/src/test/org/apache/solr/cli/PackageToolTest.java+++ b/solr/core/src/test/org/apache/solr/cli/PackageToolTest.java@@ -101,44 +101,42 @@ public class PackageToolTest extends SolrCloudTestCase {run(tool,new String[] {- "-solrUrl", solrUrl, "list-installed", "-credentials", SecurityJson.USER_PASS+ "--solr-url", solrUrl, "list-installed", "--credentials", SecurityJson.USER_PASS});run(tool,new String[] {- "-solrUrl",+ "--solr-url",solrUrl,- "-credentials",- SecurityJson.USER_PASS,"add-repo","fullstory","http://localhost:" + repositoryServer.getPort(),- "-credentials",+ "--credentials",SecurityJson.USER_PASS});run(tool,new String[] {- "-solrUrl", solrUrl, "list-available", "-credentials", SecurityJson.USER_PASS+ "--solr-url", solrUrl, "list-available", "--credentials", SecurityJson.USER_PASS});run(tool,new String[] {- "-solrUrl",+ "--solr-url",solrUrl,"install","question-answer:1.0.0",- "-credentials",+ "--credentials",SecurityJson.USER_PASS});run(tool,new String[] {- "-solrUrl", solrUrl, "list-installed", "-credentials", SecurityJson.USER_PASS+ "--solr-url", solrUrl, "list-installed", "--credentials", SecurityJson.USER_PASS});withBasicAuth(CollectionAdminRequest.createCollection("abc", "conf1", 1, 1))@@ -151,27 +149,27 @@ public class PackageToolTest extends SolrCloudTestCase {run(tool,new String[] {- "-solrUrl",+ "--solr-url",solrUrl,"list-deployed","question-answer",- "-credentials",+ "--credentials",SecurityJson.USER_PASS});run(tool,new String[] {- "-solrUrl",+ "--solr-url",solrUrl,"deploy","question-answer","-y",- "-collections",+ "--collections","abc","-p","RH-HANDLER-PATH=" + rhPath,- "-credentials",+ "--credentials",SecurityJson.USER_PASS});assertPackageVersion(@@ -180,18 +178,24 @@ public class PackageToolTest extends SolrCloudTestCase {run(tool,new String[] {- "-solrUrl",+ "--solr-url",solrUrl,"list-deployed","question-answer",- "-credentials",+ "--credentials",SecurityJson.USER_PASS});run(tool,new String[] {- "-solrUrl", solrUrl, "list-deployed", "-c", "abc", "-credentials", SecurityJson.USER_PASS+ "--solr-url",+ solrUrl,+ "list-deployed",+ "-c",+ "abc",+ "--credentials",+ SecurityJson.USER_PASS});// Should we test the "auto-update to latest" functionality or the default explicit deploy@@ -205,14 +209,14 @@ public class PackageToolTest extends SolrCloudTestCase {run(tool,new String[] {- "-solrUrl",+ "--solr-url",solrUrl,"deploy","question-answer:latest","-y",- "-collections",+ "--collections","abc",- "-credentials",+ "--credentials",SecurityJson.USER_PASS});assertPackageVersion(@@ -221,11 +225,11 @@ public class PackageToolTest extends SolrCloudTestCase {run(tool,new String[] {- "-solrUrl",+ "--solr-url",solrUrl,"install","question-answer",- "-credentials",+ "--credentials",SecurityJson.USER_PASS});assertPackageVersion(@@ -236,11 +240,11 @@ public class PackageToolTest extends SolrCloudTestCase {run(tool,new String[] {- "-solrUrl",+ "--solr-url",solrUrl,"install","question-answer",- "-credentials",+ "--credentials",SecurityJson.USER_PASS});assertPackageVersion(@@ -251,32 +255,32 @@ public class PackageToolTest extends SolrCloudTestCase {run(tool,new String[] {- "-solrUrl",+ "--solr-url",solrUrl,"deploy","--update","-y","question-answer",- "-collections",+ "--collections","abc","-p","RH-HANDLER-PATH=" + rhPath,- "-credentials",+ "--credentials",SecurityJson.USER_PASS});} else {run(tool,new String[] {- "-solrUrl",+ "--solr-url",solrUrl,"deploy","--update","-y","question-answer",- "-collections",+ "--collections","abc",- "-credentials",+ "--credentials",SecurityJson.USER_PASS});}@@ -288,24 +292,24 @@ public class PackageToolTest extends SolrCloudTestCase {run(tool,new String[] {- "-solrUrl",+ "--solr-url",solrUrl,"undeploy","question-answer",- "-collections",+ "--collections","abc",- "-credentials",+ "--credentials",SecurityJson.USER_PASS});run(tool,new String[] {- "-solrUrl",+ "--solr-url",solrUrl,"list-deployed","question-answer",- "-credentials",+ "--credentials",SecurityJson.USER_PASS});}diff --git a/solr/core/src/test/org/apache/solr/cloud/SolrCLIZkUtilsTest.java b/solr/core/src/test/org/apache/solr/cli/SolrCLIZkToolsTest.javasimilarity index 86%rename from solr/core/src/test/org/apache/solr/cloud/SolrCLIZkUtilsTest.javarename to solr/core/src/test/org/apache/solr/cli/SolrCLIZkToolsTest.javaindex f7a8da22e8f..747b78dc8ba 100644--- a/solr/core/src/test/org/apache/solr/cloud/SolrCLIZkUtilsTest.java+++ b/solr/core/src/test/org/apache/solr/cli/SolrCLIZkToolsTest.java@@ -15,7 +15,7 @@* limitations under the License.*/-package org.apache.solr.cloud;+package org.apache.solr.cli;import java.io.ByteArrayOutputStream;import java.io.File;@@ -31,13 +31,8 @@ import java.nio.file.attribute.BasicFileAttributes;import java.util.ArrayList;import java.util.List;import java.util.concurrent.TimeUnit;-import org.apache.solr.cli.ConfigSetDownloadTool;-import org.apache.solr.cli.ConfigSetUploadTool;-import org.apache.solr.cli.SolrCLI;-import org.apache.solr.cli.ZkCpTool;-import org.apache.solr.cli.ZkLsTool;-import org.apache.solr.cli.ZkMvTool;-import org.apache.solr.cli.ZkRmTool;+import org.apache.solr.cloud.AbstractDistribZkTestBase;+import org.apache.solr.cloud.SolrCloudTestCase;import org.apache.solr.common.cloud.SolrZkClient;import org.apache.solr.common.cloud.ZkMaintenanceUtils;import org.apache.zookeeper.KeeperException;@@ -46,7 +41,7 @@ import org.junit.AfterClass;import org.junit.BeforeClass;import org.junit.Test;-public class SolrCLIZkUtilsTest extends SolrCloudTestCase {+public class SolrCLIZkToolsTest extends SolrCloudTestCase {@BeforeClasspublic static void setupCluster() throws Exception {@@ -88,16 +83,10 @@ public class SolrCLIZkUtilsTest extends SolrCloudTestCase {// Now just use a name in the configsets directory, do we find it?configSet = TEST_PATH().resolve("configsets");+ File confDir = new File(configSet.toFile(), "cloud-subdirs");String[] args =new String[] {- "-confname",- "upconfig2",- "-confdir",- "cloud-subdirs",- "-zkHost",- zkAddr,- "-configsetsDir",- configSet.toAbsolutePath().toString(),+ "--conf-name", "upconfig2", "--conf-dir", confDir.getAbsolutePath(), "-z", zkAddr};ConfigSetUploadTool tool = new ConfigSetUploadTool();@@ -108,17 +97,7 @@ public class SolrCLIZkUtilsTest extends SolrCloudTestCase {verifyZkLocalPathsMatch(srcPathCheck, "/configs/upconfig2");// do we barf on a bogus path?- args =- new String[] {- "-confname",- "upconfig3",- "-confdir",- "nothinghere",- "-zkHost",- zkAddr,- "-configsetsDir",- configSet.toAbsolutePath().toString(),- };+ args = new String[] {"--conf-name", "upconfig3", "--conf-dir", "nothinghere", "-z", zkAddr};res = tool.runTool(SolrCLI.processCommandLineArgs(tool.getName(), tool.getOptions(), args));assertTrue("tool should have returned non-zero for failure ", 0 != res);@@ -146,12 +125,7 @@ public class SolrCLIZkUtilsTest extends SolrCloudTestCase {String[] args =new String[] {- "-confname",- "downconfig1",- "-confdir",- tmp.toAbsolutePath().toString(),- "-zkHost",- zkAddr,+ "--conf-name", "downconfig1", "--conf-dir", tmp.toAbsolutePath().toString(), "-z", zkAddr,};ConfigSetDownloadTool downTool = new ConfigSetDownloadTool();@@ -173,11 +147,11 @@ public class SolrCLIZkUtilsTest extends SolrCloudTestCase {downTool = new ConfigSetDownloadTool();args =new String[] {- "-confname",+ "--conf-name","downconfig2",- "-confdir",+ "--conf-dir",tmp2.toAbsolutePath().toString(),- "-zkHost",+ "-z",zkAddr,};@@ -204,10 +178,10 @@ public class SolrCLIZkUtilsTest extends SolrCloudTestCase {// Now copy it somewhere else on ZK.String[] args =new String[] {- "-src", "zk:/configs/cp1",- "-dst", "zk:/cp2",- "-recurse", "true",- "-zkHost", zkAddr,+ "--source", "zk:/configs/cp1",+ "--destination", "zk:/cp2",+ "--recurse", "true",+ "--zk-host", zkAddr,};ZkCpTool cpTool = new ZkCpTool();@@ -221,13 +195,13 @@ public class SolrCLIZkUtilsTest extends SolrCloudTestCase {Path tmp = createTempDir("tmpNewPlace2");args =new String[] {- "-src",+ "--source","zk:/configs/cp1",- "-dst",+ "--destination","file:" + tmp.toAbsolutePath(),- "-recurse",+ "--recurse","true",- "-zkHost",+ "--zk-host",zkAddr,};@@ -240,13 +214,13 @@ public class SolrCLIZkUtilsTest extends SolrCloudTestCase {tmp = createTempDir("tmpNewPlace3");args =new String[] {- "-src",+ "--source","zk:/configs/cp1",- "-dst",+ "--destination",tmp.toAbsolutePath().toString(),- "-recurse",+ "--recurse","true",- "-zkHost",+ "--zk-host",zkAddr,};@@ -258,13 +232,13 @@ public class SolrCLIZkUtilsTest extends SolrCloudTestCase {// try with local->zkargs =new String[] {- "-src",+ "--source",srcPathCheck.toAbsolutePath().toString(),- "-dst",+ "--destination","zk:/cp3",- "-recurse",+ "--recurse","true",- "-zkHost",+ "--zk-host",zkAddr,};@@ -276,13 +250,13 @@ public class SolrCLIZkUtilsTest extends SolrCloudTestCase {// try with local->zk, file: specifiedargs =new String[] {- "-src",+ "--source","file:" + srcPathCheck.toAbsolutePath(),- "-dst",+ "--destination","zk:/cp4",- "-recurse",+ "--recurse","true",- "-zkHost",+ "--zk-host",zkAddr,};@@ -294,7 +268,12 @@ public class SolrCLIZkUtilsTest extends SolrCloudTestCase {// try with recurse not specifiedargs =new String[] {- "-src", "file:" + srcPathCheck.toAbsolutePath(), "-dst", "zk:/cp5Fail", "-zkHost", zkAddr,+ "--source",+ "file:" + srcPathCheck.toAbsolutePath(),+ "--destination",+ "zk:/cp5Fail",+ "--zk-host",+ zkAddr,};res =@@ -304,13 +283,13 @@ public class SolrCLIZkUtilsTest extends SolrCloudTestCase {// try with recurse = falseargs =new String[] {- "-src",+ "--source","file:" + srcPathCheck.toAbsolutePath(),- "-dst",+ "--destination","zk:/cp6Fail",- "-recurse",+ "--recurse","false",- "-zkHost",+ "--zk-host",zkAddr,};@@ -326,7 +305,14 @@ public class SolrCLIZkUtilsTest extends SolrCloudTestCase {String localSlash = tmp.normalize() + File.separator + "cpToLocal" + File.separator;args =new String[] {- "-src", "zk:/cp3/schema.xml", "-dst", localSlash, "-recurse", "false", "-zkHost", zkAddr,+ "--source",+ "zk:/cp3/schema.xml",+ "--destination",+ localSlash,+ "--recurse",+ "false",+ "--zk-host",+ zkAddr,};res =@@ -340,13 +326,13 @@ public class SolrCLIZkUtilsTest extends SolrCloudTestCase {// src and cp3 are validargs =new String[] {- "-src",+ "--source","file:" + srcPathCheck.normalize().toAbsolutePath() + File.separator + "solrconfig.xml",- "-dst",+ "--destination","zk:/powerup/",- "-recurse",+ "--recurse","false",- "-zkHost",+ "--zk-host",zkAddr,};@@ -361,13 +347,13 @@ public class SolrCLIZkUtilsTest extends SolrCloudTestCase {// src and cp3 are validargs =new String[] {- "-src",+ "--source","file:" + srcPathCheck.normalize().toAbsolutePath() + File.separator + "solrconfig.xml",- "-dst",+ "--destination","zk:/copyUpFile.xml",- "-recurse",+ "--recurse","false",- "-zkHost",+ "--zk-host",zkAddr,};@@ -385,13 +371,13 @@ public class SolrCLIZkUtilsTest extends SolrCloudTestCase {tmp.normalize() + File.separator + "localnamed" + File.separator + "renamed.txt";args =new String[] {- "-src",+ "--source","zk:/cp4/solrconfig.xml",- "-dst",+ "--destination","file:" + localNamed,- "-recurse",+ "--recurse","false",- "-zkHost",+ "--zk-host",zkAddr,};@@ -414,10 +400,10 @@ public class SolrCLIZkUtilsTest extends SolrCloudTestCase {// Test copy from somwehere in ZK to the root of ZK.args =new String[] {- "-src", "zk:/cp4/solrconfig.xml",- "-dst", "zk:/",- "-recurse", "false",- "-zkHost", zkAddr,+ "--source", "zk:/cp4/solrconfig.xml",+ "--destination", "zk:/",+ "--recurse", "false",+ "--zk-host", zkAddr,};res =@@ -430,13 +416,13 @@ public class SolrCLIZkUtilsTest extends SolrCloudTestCase {// source path to the dstargs =new String[] {- "-src",+ "--source","file:" + srcPathCheck.toAbsolutePath(),- "-dst",+ "--destination","zk:/cp7/",- "-recurse",+ "--recurse","true",- "-zkHost",+ "--zk-host",zkAddr,};@@ -454,13 +440,13 @@ public class SolrCLIZkUtilsTest extends SolrCloudTestCase {// First, just copy the data up the cp7 since it's a directory.args =new String[] {- "-src",+ "--source","file:" + file.toAbsolutePath(),- "-dst",+ "--destination","zk:/cp7/conf/stopwords/",- "-recurse",+ "--recurse","false",- "-zkHost",+ "--zk-host",zkAddr,};@@ -480,13 +466,13 @@ public class SolrCLIZkUtilsTest extends SolrCloudTestCase {tmp = createTempDir("cp8");args =new String[] {- "-src",+ "--source","zk:/cp7",- "-dst",+ "--destination","file:" + tmp.toAbsolutePath(),- "-recurse",+ "--recurse","true",- "-zkHost",+ "--zk-host",zkAddr,};res =@@ -500,13 +486,13 @@ public class SolrCLIZkUtilsTest extends SolrCloudTestCase {// Finally, copy up to cp8 and verify that the data is up there.args =new String[] {- "-src",+ "--source","file:" + tmp.toAbsolutePath(),- "-dst",+ "--destination","zk:/cp9",- "-recurse",+ "--recurse","true",- "-zkHost",+ "--zk-host",zkAddr,};@@ -525,13 +511,13 @@ public class SolrCLIZkUtilsTest extends SolrCloudTestCase {args =new String[] {- "-src",+ "--source","file:" + emptyFile.toAbsolutePath(),- "-dst",+ "--destination","zk:/cp7/conf/stopwords/emptyfile",- "-recurse",+ "--recurse","false",- "-zkHost",+ "--zk-host",zkAddr,};@@ -543,13 +529,13 @@ public class SolrCLIZkUtilsTest extends SolrCloudTestCase {Path emptyDest = Paths.get(tmp2.toAbsolutePath().toString(), "emptyfile");args =new String[] {- "-src",+ "--source","zk:/cp7/conf/stopwords/emptyfile",- "-dst",+ "--destination","file:" + emptyDest.toAbsolutePath(),- "-recurse",+ "--recurse","false",- "-zkHost",+ "--zk-host",zkAddr,};res =@@ -562,13 +548,13 @@ public class SolrCLIZkUtilsTest extends SolrCloudTestCase {args =new String[] {- "-src",+ "--source","file:" + emptyFile.getParent().getParent().toString(),- "-dst",+ "--destination","zk:/cp10",- "-recurse",+ "--recurse","true",- "-zkHost",+ "--zk-host",zkAddr,};@@ -580,13 +566,13 @@ public class SolrCLIZkUtilsTest extends SolrCloudTestCase {tmp2 = createTempDir("cp10");args =new String[] {- "-src",+ "--source","zk:/cp10",- "-dst",+ "--destination","file:" + tmp2.toAbsolutePath(),- "-recurse",+ "--recurse","true",- "-zkHost",+ "--zk-host",zkAddr,};res =@@ -610,9 +596,9 @@ public class SolrCLIZkUtilsTest extends SolrCloudTestCase {// Now move it somewhere else.String[] args =new String[] {- "-src", "zk:/configs/mv1",- "-dst", "zk:/mv2",- "-zkHost", zkAddr,+ "--source", "zk:/configs/mv1",+ "--destination", "zk:/mv2",+ "--zk-host", zkAddr,};ZkMvTool mvTool = new ZkMvTool();@@ -630,7 +616,12 @@ public class SolrCLIZkUtilsTest extends SolrCloudTestCase {// Now fail if we specify "file:". Everything should still be in /mv2args =new String[] {- "-src", "file:" + File.separator + "mv2", "-dst", "/mv3", "-zkHost", zkAddr,+ "--source",+ "file:" + File.separator + "mv2",+ "--destination",+ "/mv3",+ "--zk-host",+ zkAddr,};// Still in mv2@@ -641,9 +632,9 @@ public class SolrCLIZkUtilsTest extends SolrCloudTestCase {// Let's move it to yet another place with no zk: prefix.args =new String[] {- "-src", "/mv2",- "-dst", "/mv4",- "-zkHost", zkAddr,+ "--source", "/mv2",+ "--destination", "/mv4",+ "--zk-host", zkAddr,};res =@@ -657,9 +648,9 @@ public class SolrCLIZkUtilsTest extends SolrCloudTestCase {args =new String[] {- "-src", "/mv4/solrconfig.xml",- "-dst", "/testmvsingle/solrconfig.xml",- "-zkHost", zkAddr,+ "--source", "/mv4/solrconfig.xml",+ "--destination", "/testmvsingle/solrconfig.xml",+ "-z", zkAddr,};res =@@ -674,9 +665,9 @@ public class SolrCLIZkUtilsTest extends SolrCloudTestCase {// what happens if the destination ends with a slash?args =new String[] {- "-src", "/mv4/schema.xml",- "-dst", "/parentnode/",- "-zkHost", zkAddr,+ "--source", "/mv4/schema.xml",+ "--destination", "/parentnode/",+ "--zk-host", zkAddr,};res =@@ -702,7 +693,7 @@ public class SolrCLIZkUtilsTest extends SolrCloudTestCase {// Should only find a single level.String[] args =new String[] {- "-path", "/configs", "-zkHost", zkAddr,+ "--path", "/configs", "--zk-host", zkAddr,};ByteArrayOutputStream baos = new ByteArrayOutputStream();@@ -719,9 +710,9 @@ public class SolrCLIZkUtilsTest extends SolrCloudTestCase {// simple ls recurse=falseargs =new String[] {- "-path", "/configs",- "-recurse", "false",- "-zkHost", zkAddr,+ "--path", "/configs",+ "--recurse", "false",+ "--zk-host", zkAddr,};res = tool.runTool(SolrCLI.processCommandLineArgs(tool.getName(), tool.getOptions(), args));@@ -734,9 +725,9 @@ public class SolrCLIZkUtilsTest extends SolrCloudTestCase {// recurse=trueargs =new String[] {- "-path", "/configs",- "-recurse", "true",- "-zkHost", zkAddr,+ "--path", "/configs",+ "--recurse", "true",+ "--zk-host", zkAddr,};res = tool.runTool(SolrCLI.processCommandLineArgs(tool.getName(), tool.getOptions(), args));@@ -749,9 +740,9 @@ public class SolrCLIZkUtilsTest extends SolrCloudTestCase {// Saw a case where going from root didn't work, so test it.args =new String[] {- "-path", "/",- "-recurse", "true",- "-zkHost", zkAddr,+ "--path", "/",+ "--recurse", "true",+ "--zk-host", zkAddr,};res = tool.runTool(SolrCLI.processCommandLineArgs(tool.getName(), tool.getOptions(), args));@@ -763,7 +754,7 @@ public class SolrCLIZkUtilsTest extends SolrCloudTestCase {args =new String[] {- "-path", "/", "-zkHost", zkAddr,+ "--path", "/", "--zk-host", zkAddr,};res = tool.runTool(SolrCLI.processCommandLineArgs(tool.getName(), tool.getOptions(), args));@@ -774,9 +765,9 @@ public class SolrCLIZkUtilsTest extends SolrCloudTestCase {// Saw a case where ending in slash didn't work, so test it.args =new String[] {- "-path", "/configs/",- "-recurse", "true",- "-zkHost", zkAddr,+ "--path", "/configs/",+ "--recurse", "true",+ "--zk-host", zkAddr,};res = tool.runTool(SolrCLI.processCommandLineArgs(tool.getName(), tool.getOptions(), args));@@ -799,7 +790,7 @@ public class SolrCLIZkUtilsTest extends SolrCloudTestCase {// Should fail if recurse not set.String[] args =new String[] {- "-path", "/configs/rm1", "-zkHost", zkAddr,+ "--path", "/configs/rm1", "--zk-host", zkAddr,};ZkRmTool tool = new ZkRmTool();@@ -814,9 +805,9 @@ public class SolrCLIZkUtilsTest extends SolrCloudTestCase {args =new String[] {- "-path", "zk:/configs/rm1",- "-recurse", "false",- "-zkHost", zkAddr,+ "--path", "zk:/configs/rm1",+ "--recurse", "false",+ "--zk-host", zkAddr,};res = tool.runTool(SolrCLI.processCommandLineArgs(tool.getName(), tool.getOptions(), args));@@ -826,9 +817,9 @@ public class SolrCLIZkUtilsTest extends SolrCloudTestCase {args =new String[] {- "-path", "/configs/rm1",- "-recurse", "true",- "-zkHost", zkAddr,+ "--path", "/configs/rm1",+ "--recurse", "true",+ "--zk-host", zkAddr,};res = tool.runTool(SolrCLI.processCommandLineArgs(tool.getName(), tool.getOptions(), args));@@ -839,9 +830,9 @@ public class SolrCLIZkUtilsTest extends SolrCloudTestCase {// Check that zk prefix also works.args =new String[] {- "-path", "zk:/configs/rm2",- "-recurse", "true",- "-zkHost", zkAddr,+ "--path", "zk:/configs/rm2",+ "--recurse", "true",+ "--zk-host", zkAddr,};res = tool.runTool(SolrCLI.processCommandLineArgs(tool.getName(), tool.getOptions(), args));@@ -852,9 +843,9 @@ public class SolrCLIZkUtilsTest extends SolrCloudTestCase {// This should silently just refuse to do anything to the / or /zookeeperargs =new String[] {- "-path", "zk:/",- "-recurse", "true",- "-zkHost", zkAddr,+ "--path", "zk:/",+ "--recurse", "true",+ "--zk-host", zkAddr,};AbstractDistribZkTestBase.copyConfigUp(configSet, "cloud-subdirs", "rm3", zkAddr);@@ -879,7 +870,9 @@ public class SolrCLIZkUtilsTest extends SolrCloudTestCase {for (String child : zkClient.getChildren(zkRoot, null, true)) {// Skip ephemeral nodes- if (zkRoot.endsWith("/") == false) zkRoot += "/";+ if (!zkRoot.endsWith("/")) {+ zkRoot += "/";+ }if (isEphemeral(zkRoot + child)) continue;Path thisPath = Paths.get(fileRoot.toAbsolutePath().toString(), child);diff --git a/solr/core/src/test/org/apache/solr/cli/TestSolrCLIRunExample.java b/solr/core/src/test/org/apache/solr/cli/TestSolrCLIRunExample.javaindex 40c7dc6489d..d99cce91099 100644--- a/solr/core/src/test/org/apache/solr/cli/TestSolrCLIRunExample.java+++ b/solr/core/src/test/org/apache/solr/cli/TestSolrCLIRunExample.java@@ -114,7 +114,9 @@ public class TestSolrCLIRunExample extends SolrTestCaseJ4 {if (exe.endsWith("solr")) {String[] args = cmd.getArguments();if ("start".equals(args[0])) {- if (!hasFlag("-cloud", args) && !hasFlag("-c", args)) return startStandaloneSolr(args);+ if (!hasFlag("--cloud", args) && !hasFlag("-c", args)) {+ return startStandaloneSolr(args);+ }String solrHomeDir = getArg("-s", args);int port = Integer.parseInt(getArg("-p", args));@@ -354,8 +356,8 @@ public class TestSolrCLIRunExample extends SolrTestCaseJ4 {String[] toolArgs =new String[] {"-e", exampleName,- "-serverDir", solrServerDir.getAbsolutePath(),- "-exampleDir", solrExampleDir.getAbsolutePath(),+ "--server-dir", solrServerDir.getAbsolutePath(),+ "--example-dir", solrExampleDir.getAbsolutePath(),"-p", String.valueOf(bindPort)};@@ -446,7 +448,7 @@ public class TestSolrCLIRunExample extends SolrTestCaseJ4 {/*** Tests the interactive SolrCloud example; we cannot test the non-interactive because we need* control over the port and can only test with one node since the test relies on setting the host- * and jetty.port system properties, i.e. there is no test coverage for the -noprompt option.+ * and jetty.port system properties, i.e. there is no test coverage for the --noprompt option.*/@Testpublic void testInteractiveSolrCloudExample() throws Exception {@@ -461,9 +463,9 @@ public class TestSolrCLIRunExample extends SolrTestCaseJ4 {String[] toolArgs =new String[] {- "-example", "cloud",- "-serverDir", solrServerDir.getAbsolutePath(),- "-exampleDir", solrExampleDir.getAbsolutePath()+ "--example", "cloud",+ "--server-dir", solrServerDir.getAbsolutePath(),+ "--example-dir", solrExampleDir.getAbsolutePath()};int bindPort = -1;@@ -552,7 +554,7 @@ public class TestSolrCLIRunExample extends SolrTestCaseJ4 {// delete the collectionDeleteTool deleteTool = new DeleteTool(stdoutSim);- String[] deleteArgs = new String[] {"-name", collectionName, "-solrUrl", solrUrl};+ String[] deleteArgs = new String[] {"--name", collectionName, "--solr-url", solrUrl};deleteTool.runTool(SolrCLI.processCommandLineArgs(deleteTool.getName(), deleteTool.getOptions(), deleteArgs));@@ -587,8 +589,8 @@ public class TestSolrCLIRunExample extends SolrTestCaseJ4 {String[] toolArgs =new String[] {"-e", "techproducts",- "-serverDir", solrServerDir.getAbsolutePath(),- "-exampleDir", solrExampleDir.getAbsolutePath(),+ "--server-dir", solrServerDir.getAbsolutePath(),+ "--example-dir", solrExampleDir.getAbsolutePath(),"-p", String.valueOf(bindPort),"-script", toExecute.getAbsolutePath().toString()};diff --git a/solr/core/src/test/org/apache/solr/cli/ZkSubcommandsTest.java b/solr/core/src/test/org/apache/solr/cli/ZkSubcommandsTest.javaindex 9ee2a7afa7b..f8e24cbcb07 100644--- a/solr/core/src/test/org/apache/solr/cli/ZkSubcommandsTest.java+++ b/solr/core/src/test/org/apache/solr/cli/ZkSubcommandsTest.java@@ -129,9 +129,9 @@ public class ZkSubcommandsTest extends SolrTestCaseJ4 {String[] args =new String[] {"cp",- "-src",+ "--source",localFile.getAbsolutePath(),- "-dst",+ "--destination","zk:/data.txt","-z",zkServer.getZkAddress()@@ -180,9 +180,9 @@ public class ZkSubcommandsTest extends SolrTestCaseJ4 {String[] args =new String[] {"cp",- "-src",+ "--source",localFile.getAbsolutePath(),- "-dst",+ "--destination","zk:/state.json","-z",zkServer.getZkAddress()@@ -210,9 +210,9 @@ public class ZkSubcommandsTest extends SolrTestCaseJ4 {args =new String[] {"cp",- "-src",+ "--source",localFile.getAbsolutePath(),- "-dst",+ "--destination","zk:/state.json","-z",zkServer.getZkAddress()@@ -234,9 +234,9 @@ public class ZkSubcommandsTest extends SolrTestCaseJ4 {String[] args =new String[] {"cp",- "-src",+ "--source",SOLR_HOME + File.separator + "solr-stress-new.xml",- "-dst",+ "--destination","zk:/foo.xml","-z",zkServer.getZkAddress()@@ -258,9 +258,9 @@ public class ZkSubcommandsTest extends SolrTestCaseJ4 {String[] args =new String[] {"cp",- "-src",+ "--source",SOLR_HOME + File.separator + "solr-stress-new.xml",- "-dst",+ "--destination","zk:foo.xml","-z",zkServer.getZkAddress()@@ -285,9 +285,9 @@ public class ZkSubcommandsTest extends SolrTestCaseJ4 {String[] args =new String[] {"cp",- "-src",+ "--source",SOLR_HOME + File.separator + "solr-stress-new.xml",- "-dst",+ "--destination","zk:/state.json","-z",zkServer.getZkAddress()@@ -316,9 +316,9 @@ public class ZkSubcommandsTest extends SolrTestCaseJ4 {String[] args =new String[] {"cp",- "-src",+ "--source",SOLR_HOME + File.separator + "not-there.xml",- "-dst",+ "--destination","zk:/foo.xml","-z",zkServer.getZkAddress()@@ -332,7 +332,7 @@ public class ZkSubcommandsTest extends SolrTestCaseJ4 {public void testLs() throws Exception {zkClient.makePath("/test/path", true);- String[] args = new String[] {"ls", "-path", "/", "-r", "true", "-z", zkServer.getZkAddress()};+ String[] args = new String[] {"ls", "--path", "/", "-r", "true", "-z", zkServer.getZkAddress()};ByteArrayOutputStream byteStream = new ByteArrayOutputStream();final PrintStream myOut = new PrintStream(byteStream, false, StandardCharsets.UTF_8);@@ -358,9 +358,9 @@ public class ZkSubcommandsTest extends SolrTestCaseJ4 {String[] args =new String[] {"upconfig",- "--confname",+ "--conf-name",confsetname,- "--confdir",+ "--conf-dir",ExternalPaths.TECHPRODUCTS_CONFIGSET,"-z",zkServer.getZkAddress()@@ -380,7 +380,7 @@ public class ZkSubcommandsTest extends SolrTestCaseJ4 {args =new String[] {"linkconfig",- "--confname",+ "--conf-name",confsetname,"-c","collection1",@@ -406,9 +406,9 @@ public class ZkSubcommandsTest extends SolrTestCaseJ4 {args =new String[] {"downconfig",- "--confname",+ "--conf-name",confsetname,- "--confdir",+ "--conf-dir",configSetDir.getAbsolutePath(),"-z",zkServer.getZkAddress()@@ -463,7 +463,7 @@ public class ZkSubcommandsTest extends SolrTestCaseJ4 {// test reset zkargs =new String[] {- "rm", "-path", "zk:/configs/confsetone", "-r", "true", "-z", zkServer.getZkAddress()+ "rm", "--path", "zk:/configs/confsetone", "-r", "true", "-z", zkServer.getZkAddress()};ZkRmTool zkRmTool = new ZkRmTool();@@ -483,9 +483,9 @@ public class ZkSubcommandsTest extends SolrTestCaseJ4 {String[] args =new String[] {"cp",- "-src",+ "--source","zk:" + getNode,- "-dst",+ "--destination",localFile.getAbsolutePath(),"-z",zkServer.getZkAddress()@@ -522,9 +522,9 @@ public class ZkSubcommandsTest extends SolrTestCaseJ4 {String[] args =new String[] {"cp",- "-src",+ "--source","zk:" + getNode,- "-dst",+ "--destination",localFile.getAbsolutePath(),"-z",zkServer.getZkAddress()@@ -550,9 +550,9 @@ public class ZkSubcommandsTest extends SolrTestCaseJ4 {String[] args =new String[] {"cp",- "-src",+ "--source","zk:" + getNode,- "-dst",+ "--destination",file.toAbsolutePath().toString(),"-z",zkServer.getZkAddress()@@ -582,9 +582,9 @@ public class ZkSubcommandsTest extends SolrTestCaseJ4 {String[] args =new String[] {"cp",- "-src",+ "--source","zk:" + getNode,- "-dst",+ "--destination",file.toAbsolutePath().toString(),"-z",zkServer.getZkAddress()@@ -605,9 +605,9 @@ public class ZkSubcommandsTest extends SolrTestCaseJ4 {String[] args =new String[] {"cp",- "-src",+ "--source","zk:" + getNode,- "-dst",+ "--destination",file.getAbsolutePath(),"-z",zkServer.getZkAddress()@@ -620,7 +620,7 @@ public class ZkSubcommandsTest extends SolrTestCaseJ4 {@Testpublic void testInvalidZKAddress() throws Exception {- String[] args = new String[] {"ls", "-path", "/", "-r", "true", "-z", "----------:33332"};+ String[] args = new String[] {"ls", "--path", "/", "-r", "true", "-z", "----------:33332"};ByteArrayOutputStream byteStream2 = new ByteArrayOutputStream();final PrintStream myOut2 = new PrintStream(byteStream2, false, StandardCharsets.UTF_8);diff --git a/solr/core/src/test/org/apache/solr/cloud/SolrCloudExampleTest.java b/solr/core/src/test/org/apache/solr/cloud/SolrCloudExampleTest.javaindex b77a880bdbd..944e5e81272 100644--- a/solr/core/src/test/org/apache/solr/cloud/SolrCloudExampleTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/SolrCloudExampleTest.java@@ -38,7 +38,7 @@ import org.slf4j.Logger;import org.slf4j.LoggerFactory;/**- * Emulates bin/solr start -e cloud -noprompt; bin/solr post -c gettingstarted+ * Emulates bin/solr start -e cloud --no-prompt; bin/solr post -c gettingstarted* example/exampledocs/*.xml; this test is useful for catching regressions in indexing the example* docs in collections that use data driven functionality and managed schema features of the default* configset (configsets/_default).@@ -73,19 +73,17 @@ public class SolrCloudExampleTest extends AbstractFullDistribZkTestBase {// create the gettingstarted collection just like the bin/solr script would doString[] args =new String[] {- "-name",+ "--name",testCollectionName,- "-shards",+ "--shards","2",- "-replicationFactor",+ "--replication-factor","2",- "-confname",+ "--conf-name",testCollectionName,- "-confdir",+ "--conf-dir","_default",- "-configsetsDir",- defaultConfigs.getParentFile().getParentFile().getAbsolutePath(),- "-solrUrl",+ "--solr-url",solrUrl};@@ -119,7 +117,7 @@ public class SolrCloudExampleTest extends AbstractFullDistribZkTestBase {new String[] {"--solr-update-url",solrUrl + "/" + testCollectionName + "/update",- "-filetypes",+ "--filetypes","xml",exampleDocsDir.toAbsolutePath().toString()};@@ -157,8 +155,8 @@ public class SolrCloudExampleTest extends AbstractFullDistribZkTestBase {protected void doTestHealthcheck(String testCollectionName, String zkHost) throws Exception {String[] args =new String[] {- "-name", testCollectionName,- "-zkHost", zkHost+ "--name", testCollectionName,+ "--zk-host", zkHost};HealthcheckTool tool = new HealthcheckTool();CommandLine cli = SolrCLI.processCommandLineArgs(tool.getName(), tool.getOptions(), args);@@ -168,8 +166,8 @@ public class SolrCloudExampleTest extends AbstractFullDistribZkTestBase {protected void doTestDeleteAction(String testCollectionName, String solrUrl) throws Exception {String[] args =new String[] {- "-name", testCollectionName,- "-solrUrl", solrUrl+ "--name", testCollectionName,+ "--solr-url", solrUrl};DeleteTool tool = new DeleteTool();CommandLine cli = SolrCLI.processCommandLineArgs(tool.getName(), tool.getOptions(), args);diff --git a/solr/core/src/test/org/apache/solr/security/BasicAuthIntegrationTest.java b/solr/core/src/test/org/apache/solr/security/BasicAuthIntegrationTest.javaindex aed2a742632..5c78e5ef9b5 100644--- a/solr/core/src/test/org/apache/solr/security/BasicAuthIntegrationTest.java+++ b/solr/core/src/test/org/apache/solr/security/BasicAuthIntegrationTest.java@@ -298,7 +298,7 @@ public class BasicAuthIntegrationTest extends SolrCloudAuthTestCase {verifySecurityStatus(cl, baseUrl + "/admin/info/key", "key", NOT_NULL_PREDICATE, 20);assertAuthMetricsMinimums(17, 8, 8, 1, 0, 0);- String[] toolArgs = new String[] {"status", "-solrUrl", baseUrl};+ String[] toolArgs = new String[] {"status", "--solr-url", baseUrl};ByteArrayOutputStream baos = new ByteArrayOutputStream();PrintStream stdoutSim = new PrintStream(baos, true, StandardCharsets.UTF_8.name());StatusTool tool = new StatusTool(stdoutSim);diff --git a/solr/example/README.md b/solr/example/README.mdindex cffc0dbb6b9..09bb2dfb277 100644--- a/solr/example/README.md+++ b/solr/example/README.md@@ -39,7 +39,7 @@ For instance, if you want to run the SolrCloud example, do:To see all the options available when starting Solr:```- bin/solr start -help+ bin/solr start --help```After starting a Solr example, direct your Web browser to:diff --git a/solr/packaging/README.txt b/solr/packaging/README.txtindex 3fab2773bb0..8e417165284 100644--- a/solr/packaging/README.txt+++ b/solr/packaging/README.txt@@ -29,7 +29,7 @@ How to UseTo get started run```- bin/solr -help+ bin/solr --help```Solr includes a few examples to help you get started. For instance, if you want@@ -56,7 +56,7 @@ Files included in an Apache Solr binary distributionserver/A self-contained Solr instance, complete with a sample- configuration and documents to index. Please see: bin/solr start -help+ configuration and documents to index. Please see: bin/solr start --helpfor more information about starting a Solr server.bin/diff --git a/solr/packaging/test/bats_helper.bash b/solr/packaging/test/bats_helper.bashindex ccc2aabf2c9..68c29686a99 100644--- a/solr/packaging/test/bats_helper.bash+++ b/solr/packaging/test/bats_helper.bash@@ -59,7 +59,7 @@ save_home_on_failure() {}shutdown_all() {- solr stop -all >/dev/null 2>&1+ solr stop --all >/dev/null 2>&1}shutdown_exporter(){diff --git a/solr/packaging/test/test_assert.bats b/solr/packaging/test/test_assert.batsindex c27453b0c56..57413b119f0 100644--- a/solr/packaging/test/test_assert.bats+++ b/solr/packaging/test/test_assert.bats@@ -25,7 +25,7 @@ teardown() {# save a snapshot of SOLR_HOME for failed testssave_home_on_failure- solr stop -all >/dev/null 2>&1+ solr stop --all >/dev/null 2>&1}@test "assert for non cloud mode" {diff --git a/solr/packaging/test/test_auth.bats b/solr/packaging/test/test_auth.batsindex 11fd6a7c44c..9dcabdaf8f9 100644--- a/solr/packaging/test/test_auth.bats+++ b/solr/packaging/test/test_auth.bats@@ -25,26 +25,26 @@ setup() {# Note: there are additional auth related tests in test_ssl.bats-@test "auth rejects blockUnknown option with invalid boolean" {- run ! solr auth enable -type basicAuth -credentials any:any -blockUnknown ture- assert_output --partial "Argument [blockUnknown] must be either true or false, but was [ture]"+@test "auth rejects block-unknown option with invalid boolean" {+ run ! solr auth enable --type basicAuth --credentials any:any --block-unknown ture+ assert_output --partial "Argument [block-unknown] must be either true or false, but was [ture]"}-@test "auth rejects updateIncludeFileOnly option with invalid boolean" {- run ! solr auth enable -type basicAuth -credentials any:any -updateIncludeFileOnly ture- assert_output --partial "Argument [updateIncludeFileOnly] must be either true or false, but was [ture]"+@test "auth rejects update-include-file-only option with invalid boolean" {+ run ! solr auth enable --type basicAuth --credentials any:any --update-include-file-only ture+ assert_output --partial "Argument [update-include-file-only] must be either true or false, but was [ture]"}@test "auth enable/disable lifecycle" {solr start -c- solr auth enable -type basicAuth -credentials name:password+ solr auth enable --type basicAuth --credentials name:passwordsolr assert --started http://localhost:${SOLR_PORT} --timeout 5000run curl -u name:password --basic "http://localhost:${SOLR_PORT}/solr/admin/collections?action=CREATE&collection.configName=_default&name=test&numShards=2&replicationFactor=1&router.name=compositeId&wt=json"assert_output --partial '"status":0'-+solr auth disablerun curl "http://localhost:${SOLR_PORT}/solr/test/select?q=*:*"assert_output --partial '"numFound":0'- solr stop -all+ solr stop --all}diff --git a/solr/packaging/test/test_basic_auth.bats b/solr/packaging/test/test_basic_auth.batsindex 28a9efa0335..8cd997a08ad 100644--- a/solr/packaging/test/test_basic_auth.bats+++ b/solr/packaging/test/test_basic_auth.bats@@ -24,10 +24,10 @@ setup() {solr start -c -Denable.packages=true# The auth command exports some system variables that are injected as basic auth username and password,- # however that defeats our test so fake that out via -solrIncludeFile param specifing a bogus path.- solr auth enable -type basicAuth -credentials name:password -solrIncludeFile /force/credentials/to/be/supplied+ # however that defeats our test so fake that out via --solr-include-file param specifing a bogus path.+ solr auth enable --type basicAuth --credentials name:password --solr-include-file /force/credentials/to/be/supplied- solr assert -credentials name:password --cloud http://localhost:${SOLR_PORT} --timeout 5000+ solr assert --credentials name:password --cloud http://localhost:${SOLR_PORT} --timeout 5000}teardown() {@@ -35,7 +35,7 @@ teardown() {save_home_on_failurerun solr auth disable -z localhost:${ZK_PORT}- solr stop -all >/dev/null 2>&1+ solr stop --all >/dev/null 2>&1}# Remaining commands that should support basic auth:@@ -49,15 +49,15 @@ teardown() {assert_output --partial "Created collection 'COLL_NAME'"# Test config- run solr config -u name:password -c COLL_NAME -action set-property -property updateHandler.autoCommit.maxDocs -value 100 -solrUrl http://localhost:${SOLR_PORT}/solr+ run solr config -u name:password -c COLL_NAME --action set-property -property updateHandler.autoCommit.maxDocs --value 100 --solr-url http://localhost:${SOLR_PORT}/solrassert_output --partial "Successfully set-property updateHandler.autoCommit.maxDocs to 100"# Test api- run solr api -u name:password -get "http://localhost:${SOLR_PORT}/solr/COLL_NAME/select?q=*:*" -verbose+ run solr api -u name:password --solr-url "http://localhost:${SOLR_PORT}/solr/COLL_NAME/select?q=*:*" -verboseassert_output --partial '"numFound":0'# Test delete- run solr delete --credentials name:password -c COLL_NAME -zkHost localhost:${ZK_PORT} -verbose+ run solr delete --credentials name:password -c COLL_NAME -z localhost:${ZK_PORT} -verboseassert_output --partial "Deleted collection 'COLL_NAME'"refute collection_exists "COLL_NAME"@@ -69,22 +69,22 @@ run solr create -c COLL_NAMEassert_output --partial "Created collection 'COLL_NAME'"# Test post- run solr post -u name:password -type application/xml -url http://localhost:${SOLR_PORT}/solr/monitors/update ${SOLR_TIP}/example/exampledocs/monitor.xml+ run solr post -u name:password -type application/xml --solr-update-url http://localhost:${SOLR_PORT}/solr/monitors/update ${SOLR_TIP}/example/exampledocs/monitor.xmlassert_output --partial '1 files indexed.'# Test postlogs- run solr postlogs -u name:password -url http://localhost:${SOLR_PORT}/solr/COLL_NAME -rootdir ${SOLR_LOGS_DIR}/solr.log+ run solr postlogs -u name:password --solr-collection-url http://localhost:${SOLR_PORT}/solr/COLL_NAME -rootdir ${SOLR_LOGS_DIR}/solr.logassert_output --partial 'Committed'# Test export- #run solr export -u name:password -url "http://localhost:${SOLR_PORT}/solr/COLL_NAME" -query "*:*" -out "${BATS_TEST_TMPDIR}/output"+ #run solr export -u name:password --solr-collection-url "http://localhost:${SOLR_PORT}/solr/COLL_NAME" -query "*:*" -out "${BATS_TEST_TMPDIR}/output"#assert_output --partial 'Export complete'}@test "package with basic auth" {- run solr package deploy PACKAGE_NAME -credentials name:password -collections foo-1.2+ run solr package deploy PACKAGE_NAME --credentials name:password --collections foo-1.2# verify that package tool is communicating with Solr via basic authassert_output --partial "Collection(s) doesn't exist: [foo-1.2]"#assert_output --partial "Deployment successful"diff --git a/solr/packaging/test/test_bats.bats b/solr/packaging/test/test_bats.batsindex 7fbe19c74b4..f2983f4edcd 100644--- a/solr/packaging/test/test_bats.bats+++ b/solr/packaging/test/test_bats.bats@@ -34,8 +34,8 @@ teardown_file() {# Conversely, on shutdown, we do need this to execute strictly# because using "run" will eat failing test exit codes- solr stop -all- # DEBUG : (echo -n "# " ; solr stop -V -all) >&3+ solr stop --all+ # DEBUG : (echo -n "# " ; solr stop -V --all) >&3}teardown() {diff --git a/solr/packaging/test/test_config.bats b/solr/packaging/test/test_config.batsindex 84a6efb1a17..1467e06be7f 100644--- a/solr/packaging/test/test_config.bats+++ b/solr/packaging/test/test_config.bats@@ -24,7 +24,7 @@ setup_file() {teardown_file() {common_setup- solr stop -all+ solr stop --all}setup() {@@ -41,14 +41,37 @@ teardown() {@test "setting property" {solr create -c COLL_NAME- run solr config -c COLL_NAME -action set-property -property updateHandler.autoCommit.maxDocs -value 100 -solrUrl http://localhost:${SOLR_PORT}/solr+ run solr config -c COLL_NAME --action set-property --property updateHandler.autoCommit.maxDocs --value 100 --solr-url http://localhost:${SOLR_PORT}assert_output --partial "Successfully set-property updateHandler.autoCommit.maxDocs to 100"}@test "short form of setting property" {solr create -c COLL_NAME- run solr config -c COLL_NAME -property updateHandler.autoCommit.maxDocs -value 100+ run solr config -c COLL_NAME --property updateHandler.autoCommit.maxDocs -v 100assert_output --partial "Successfully set-property updateHandler.autoCommit.maxDocs to 100"- assert_output --partial "assuming solrUrl is http://localhost:${SOLR_PORT}."+ assert_output --partial "assuming solr url is http://localhost:${SOLR_PORT}."+}++# This test is to validate the deprecated and non deprecated options for connecting to Solr+@test "connecting to solr via various solr urls and zk hosts" {+ solr create -c COLL_NAME++ run solr config -c COLL_NAME --property updateHandler.autoCommit.maxDocs -v 100 -solrUrl http://localhost:${SOLR_PORT}+ assert_output --partial "Successfully set-property updateHandler.autoCommit.maxDocs to 100"+ assert_output --partial "Deprecated for removal since 9.7: Use --solr-url instead"++ run solr config -c COLL_NAME --property updateHandler.autoCommit.maxDocs -v 100 --solr-url http://localhost:${SOLR_PORT}+ assert_output --partial "Successfully set-property updateHandler.autoCommit.maxDocs to 100"++ run solr config -c COLL_NAME --property updateHandler.autoCommit.maxDocs -v 100 -zkHost localhost:${ZK_PORT}+ assert_output --partial "Successfully set-property updateHandler.autoCommit.maxDocs to 100"+ assert_output --partial "Deprecated for removal since 9.7: Use --zk-host instead"++ run solr config -c COLL_NAME --property updateHandler.autoCommit.maxDocs -v 100 -z localhost:${ZK_PORT}+ assert_output --partial "Successfully set-property updateHandler.autoCommit.maxDocs to 100"++ run solr config -c COLL_NAME --property updateHandler.autoCommit.maxDocs -v 100 --zk-host localhost:${ZK_PORT}+ assert_output --partial "Successfully set-property updateHandler.autoCommit.maxDocs to 100"+}diff --git a/solr/packaging/test/test_create.bats b/solr/packaging/test/test_create.batsindex 142c11c3d4b..e59a9055852 100644--- a/solr/packaging/test/test_create.bats+++ b/solr/packaging/test/test_create.bats@@ -25,7 +25,7 @@ teardown() {# save a snapshot of SOLR_HOME for failed testssave_home_on_failure- solr stop -all >/dev/null 2>&1+ solr stop --all >/dev/null 2>&1}@test "create for non cloud mode" {diff --git a/solr/packaging/test/test_create_collection.bats b/solr/packaging/test/test_create_collection.batsindex deaa214f628..05ec63d7f74 100644--- a/solr/packaging/test/test_create_collection.bats+++ b/solr/packaging/test/test_create_collection.bats@@ -24,7 +24,7 @@ setup_file() {teardown_file() {common_setup- solr stop -all+ solr stop --all}setup() {@@ -41,24 +41,24 @@ teardown() {@test "create collection" {run solr create -c COLL_NAMEassert_output --partial "Created collection 'COLL_NAME'"- assert_output --partial "assuming solrUrl is http://localhost:${SOLR_PORT}"+ assert_output --partial "assuming solr url is http://localhost:${SOLR_PORT}"}@test "create collection using solrUrl" {- run solr create -c COLL_NAME -solrUrl http://localhost:${SOLR_PORT}+ run solr create -c COLL_NAME --solr-url http://localhost:${SOLR_PORT}assert_output --partial "Created collection 'COLL_NAME'"- refute_output --partial "assuming solrUrl is http://localhost:${SOLR_PORT}"+ refute_output --partial "assuming solr url is http://localhost:${SOLR_PORT}"}@test "create collection using legacy solrUrl" {- run solr create -c COLL_NAME -solrUrl http://localhost:${SOLR_PORT}/solr+ run solr create -c COLL_NAME --solr-url http://localhost:${SOLR_PORT}/solrassert_output --partial "Created collection 'COLL_NAME'"assert_output --partial "needn't include Solr's context-root"- refute_output --partial "assuming solrUrl is http://localhost:${SOLR_PORT}"+ refute_output --partial "assuming solr url is http://localhost:${SOLR_PORT}"}@test "create collection using Zookeeper" {- run solr create -c COLL_NAME -zkHost localhost:${ZK_PORT}+ run solr create -c COLL_NAME -z localhost:${ZK_PORT}assert_output --partial "Created collection 'COLL_NAME'"}@@ -68,7 +68,7 @@ teardown() {}@test "accept d option with builtin config" {- run solr create -c COLL_NAME -d sample_techproducts_configs -solrUrl http://localhost:${SOLR_PORT}+ run solr create -c COLL_NAME -d sample_techproducts_configs --solr-url http://localhost:${SOLR_PORT}assert_output --partial "Created collection 'COLL_NAME'"}@@ -78,34 +78,34 @@ teardown() {test -d $source_configset_dircp -r "${source_configset_dir}" "${dest_configset_dir}"- run solr create -c COLL_NAME -d "${dest_configset_dir}" -solrUrl http://localhost:${SOLR_PORT}+ run solr create -c COLL_NAME -d "${dest_configset_dir}" --solr-url http://localhost:${SOLR_PORT}assert_output --partial "Created collection 'COLL_NAME'"}@test "accept n option as config name" {- run solr create -c COLL_NAME -n other_conf_name -solrUrl http://localhost:${SOLR_PORT}+ run solr create -c COLL_NAME -n other_conf_name --solr-url http://localhost:${SOLR_PORT}assert_output --partial "Created collection 'COLL_NAME'"assert_output --partial "config-set 'other_conf_name'"}@test "allow config reuse when n option specifies same config" {- run -0 solr create -c COLL_NAME_1 -n shared_config -solrUrl http://localhost:${SOLR_PORT}+ run -0 solr create -c COLL_NAME_1 -n shared_config --solr-url http://localhost:${SOLR_PORT}assert_output --partial "Created collection 'COLL_NAME_1'"assert_output --partial "config-set 'shared_config'"- run -0 solr create -c COLL_NAME_2 -n shared_config -solrUrl http://localhost:${SOLR_PORT}+ run -0 solr create -c COLL_NAME_2 -n shared_config --solr-url http://localhost:${SOLR_PORT}assert_output --partial "Created collection 'COLL_NAME_2'"assert_output --partial "config-set 'shared_config'"}@test "create multisharded collections when s provided" {- run -0 solr create -c COLL_NAME -s 2 -solrUrl http://localhost:${SOLR_PORT}+ run -0 solr create -c COLL_NAME -s 2 --solr-url http://localhost:${SOLR_PORT}assert_output --partial "Created collection 'COLL_NAME'"assert_output --partial "2 shard(s)"}@test "create replicated collections when rf provided" {- run -0 solr create -c COLL_NAME -rf 2 -solrUrl http://localhost:${SOLR_PORT}+ run -0 solr create -c COLL_NAME -rf 2 --solr-url http://localhost:${SOLR_PORT}assert_output --partial "Created collection 'COLL_NAME'"assert_output --partial "2 replica(s)"}diff --git a/solr/packaging/test/test_delete_collection.bats b/solr/packaging/test/test_delete_collection.batsindex b890888aa6d..0bc662b138b 100644--- a/solr/packaging/test/test_delete_collection.bats+++ b/solr/packaging/test/test_delete_collection.bats@@ -24,7 +24,7 @@ setup_file() {teardown_file() {common_setup- solr stop -all+ solr stop --all}setup() {@@ -46,11 +46,11 @@ teardown() {refute collection_exists "COLL_NAME"}-@test "can delete collections with solrUrl" {+@test "can delete collections with solr-url" {solr create -c "COLL_NAME"assert collection_exists "COLL_NAME"- solr delete -c "COLL_NAME" -solrUrl http://localhost:${SOLR_PORT}+ solr delete -c "COLL_NAME" --solr-url http://localhost:${SOLR_PORT}refute collection_exists "COLL_NAME"}@@ -70,10 +70,10 @@ teardown() {refute config_exists "NONDEFAULT_CONFIG_NAME"}-@test "deleteConfig option can opt to leave config in zk" {+@test "delete-config option can opt to leave config in zk" {solr create -c "COLL_NAME"assert config_exists "COLL_NAME"- solr delete -c "COLL_NAME" -deleteConfig false+ solr delete -c "COLL_NAME" --delete-config falseassert config_exists "COLL_NAME"}diff --git a/solr/packaging/test/test_example_noprompt.bats b/solr/packaging/test/test_example_noprompt.batsindex a688579a1e7..7d5817a8847 100644--- a/solr/packaging/test/test_example_noprompt.bats+++ b/solr/packaging/test/test_example_noprompt.bats@@ -25,11 +25,11 @@ teardown() {# save a snapshot of SOLR_HOME for failed testssave_home_on_failure- solr stop -all >/dev/null 2>&1+ solr stop --all >/dev/null 2>&1}-@test "SOLR-16755 test works with noprompt" {- solr start -e cloud -noprompt+@test "SOLR-16755 test works with --no-prompt" {+ solr start -e cloud --no-promptsolr assert --started http://localhost:${SOLR_PORT} --timeout 10000solr assert --started http://localhost:${SOLR2_PORT} --timeout 10000}diff --git a/solr/packaging/test/test_export.bats b/solr/packaging/test/test_export.batsindex 5e7d337d609..d1c00bb33de 100644--- a/solr/packaging/test/test_export.bats+++ b/solr/packaging/test/test_export.bats@@ -25,12 +25,12 @@ teardown() {# save a snapshot of SOLR_HOME for failed testssave_home_on_failure- solr stop -all >/dev/null 2>&1+ solr stop --all >/dev/null 2>&1}@test "Check export command" {run solr start -c -e techproducts- run solr export -url "http://localhost:${SOLR_PORT}/solr/techproducts" -query "*:* -id:test" -out "${BATS_TEST_TMPDIR}/output"+ run solr export --solr-collection-url "http://localhost:${SOLR_PORT}/solr/techproducts" -query "*:* -id:test" -out "${BATS_TEST_TMPDIR}/output"refute_output --partial 'Unrecognized option'assert_output --partial 'Export complete'diff --git a/solr/packaging/test/test_extraction.bats b/solr/packaging/test/test_extraction.batsindex 4322e58fcfd..7557dc93b94 100644--- a/solr/packaging/test/test_extraction.bats+++ b/solr/packaging/test/test_extraction.bats@@ -27,7 +27,7 @@ teardown() {save_home_on_failuredelete_all_collections- SOLR_STOP_WAIT=1 solr stop -all >/dev/null 2>&1+ SOLR_STOP_WAIT=1 solr stop --all >/dev/null 2>&1}@test "using curl to extract a single pdf file" {diff --git a/solr/packaging/test/test_healthcheck.bats b/solr/packaging/test/test_healthcheck.batsindex 98a97c5b9e9..14692f6561f 100644--- a/solr/packaging/test/test_healthcheck.bats+++ b/solr/packaging/test/test_healthcheck.bats@@ -25,7 +25,7 @@ teardown() {# save a snapshot of SOLR_HOME for failed testssave_home_on_failure- solr stop -all >/dev/null 2>&1+ solr stop --all >/dev/null 2>&1}@test "healthcheck on cloud solr" {diff --git a/solr/packaging/test/test_help.bats b/solr/packaging/test/test_help.batsindex 3f929eee351..782fd8af4cf 100644--- a/solr/packaging/test/test_help.bats+++ b/solr/packaging/test/test_help.bats@@ -22,7 +22,7 @@ setup() {}@test "solr help flag prints help" {- run -1 solr -help+ run -1 solr --helpassert_output --partial 'Usage: solr COMMAND OPTIONS'refute_output --partial 'ERROR'}@@ -33,7 +33,7 @@ setup() {}@test "start help flag prints help" {- run solr start -help+ run solr start --helpassert_output --partial 'Usage: solr start'refute_output --partial 'ERROR'}@@ -47,67 +47,69 @@ setup() {@test "stop help flag prints help" {- run solr stop -help+ run solr stop --helpassert_output --partial 'Usage: solr stop'refute_output --partial 'ERROR'}@test "restart help flag prints help" {- run solr restart -help+ run solr restart --helpassert_output --partial 'Usage: solr restart'refute_output --partial 'ERROR'}@test "status help flag prints help" {- run solr status -help+ run solr status --helpassert_output --partial 'usage: status'refute_output --partial 'ERROR'# Make sure custom selection of options for status help works.- refute_output --partial '-solrUrl'+ refute_output --partial '--solr-url'}@test "healthcheck help flag prints help" {- run solr healthcheck -help+ run solr healthcheck --helpassert_output --partial 'usage: healthcheck'refute_output --partial 'ERROR'}@test "create help flag prints help" {- run solr create -help+ run solr create --helpassert_output --partial 'usage: create'refute_output --partial 'ERROR'}@test "delete help flag prints help" {- run solr delete -help+ run solr delete -hassert_output --partial 'usage: delete'refute_output --partial 'ERROR'}@test "version help flag prints help" {- skip "Currently the version -help flag doesn't return nice help text!"+ run solr version -h+ assert_output --partial 'usage: version'+ refute_output --partial 'ERROR'}@test "zk help flag prints help" {- run solr zk -help+ run solr zk --helpassert_output --partial 'Usage: solr zk'refute_output --partial 'ERROR'}@test "auth help flag prints help" {- run solr auth -help+ run solr auth --helpassert_output --partial 'Usage: solr auth'refute_output --partial 'ERROR'}@test "assert help flag prints help" {- run solr assert -help+ run solr assert --helpassert_output --partial 'usage: assert'refute_output --partial 'ERROR'}@test "post help flag prints help" {- run solr post -help+ run solr post --helpassert_output --partial 'usage: post'refute_output --partial 'ERROR'}diff --git a/solr/packaging/test/test_modules.bats b/solr/packaging/test/test_modules.batsindex 543c6ecc65d..8e0a2faae35 100644--- a/solr/packaging/test/test_modules.bats+++ b/solr/packaging/test/test_modules.bats@@ -26,13 +26,13 @@ teardown() {save_home_on_failuredelete_all_collections- SOLR_STOP_WAIT=1 solr stop -all >/dev/null 2>&1+ SOLR_STOP_WAIT=1 solr stop --all >/dev/null 2>&1}@test "SQL Module" {run solr start -c -Dsolr.modules=sqlrun solr create -c COLL_NAME- run solr api -get http://localhost:${SOLR_PORT}/solr/COLL_NAME/sql?stmt=select+id+from+COLL_NAME+limit+10+ run solr api --solr-url http://localhost:${SOLR_PORT}/solr/COLL_NAME/sql?stmt=select+id+from+COLL_NAME+limit+10assert_output --partial '"docs":'assert_output --partial '"EOF":true'assert_output --partial '"RESPONSE_TIME":'diff --git a/solr/packaging/test/test_packages.bats b/solr/packaging/test/test_packages.batsindex 392729ad28b..4ec786f717c 100644--- a/solr/packaging/test/test_packages.bats+++ b/solr/packaging/test/test_packages.bats@@ -25,7 +25,7 @@ teardown() {# save a snapshot of SOLR_HOME for failed testssave_home_on_failure- solr stop -all >/dev/null 2>&1+ solr stop --all >/dev/null 2>&1}@test "package detects no running solr" {@@ -40,7 +40,7 @@ teardown() {run solr packagerefute_output --partial "No Solr nodes are running."- run solr package -help+ run solr package --helpassert_output --partial "Add a repository to Solr"run solr package list-availablediff --git a/solr/packaging/test/test_placement_plugin.bats b/solr/packaging/test/test_placement_plugin.batsindex c5ca80c30a5..918c3ac59ec 100644--- a/solr/packaging/test/test_placement_plugin.bats+++ b/solr/packaging/test/test_placement_plugin.bats@@ -26,7 +26,7 @@ teardown() {save_home_on_failuredelete_all_collections- solr stop -all >/dev/null 2>&1+ solr stop --all >/dev/null 2>&1}@test "Affinity placement plugin using sysprop" {diff --git a/solr/packaging/test/test_post.bats b/solr/packaging/test/test_post.batsindex 31a4e8235cc..023cefa5a66 100644--- a/solr/packaging/test/test_post.bats+++ b/solr/packaging/test/test_post.bats@@ -24,7 +24,7 @@ setup_file() {teardown_file() {common_setup- solr stop -all+ solr stop --all}setup() {@@ -39,87 +39,87 @@ teardown() {@test "Check help command" {run solr post- assert_output --partial 'Must specify either -url or -c parameter'-+ assert_output --partial 'Must specify either --solr-update-url or -c parameter'+run solr post -hassert_output --partial 'usage: post'refute_output --partial 'ERROR'-- run solr post -help++ run solr post --helpassert_output --partial 'usage: post'- refute_output --partial 'ERROR'-+ refute_output --partial 'ERROR'+}@test "basic post with a type specified" {-+run solr create -c monitors -d _defaultassert_output --partial "Created collection 'monitors'"-- run solr post -type application/xml -url http://localhost:${SOLR_PORT}/solr/monitors/update ${SOLR_TIP}/example/exampledocs/monitor.xml++ run solr post --type application/xml --solr-update-url http://localhost:${SOLR_PORT}/solr/monitors/update ${SOLR_TIP}/example/exampledocs/monitor.xmlassert_output --partial '1 files indexed.'refute_output --partial 'ERROR'}@test "basic post with collection instead of url parameter" {-+run solr create -c monitors_c_param -d _defaultassert_output --partial "Created collection 'monitors_c_param'"-- run solr post -type application/xml -c monitors_c_param ${SOLR_TIP}/example/exampledocs/monitor.xml++ run solr post --type application/xml -c monitors_c_param ${SOLR_TIP}/example/exampledocs/monitor.xmlassert_output --partial '1 files indexed.'refute_output --partial 'ERROR'}@test "basic post WITHOUT a type specified" {-+solr create -c monitors_no_type -d _default-- run solr post -url http://localhost:${SOLR_PORT}/solr/monitors_no_type/update ${SOLR_TIP}/example/exampledocs/monitor.xml++ run solr post --solr-update-url http://localhost:${SOLR_PORT}/solr/monitors_no_type/update ${SOLR_TIP}/example/exampledocs/monitor.xmlassert_output --partial '1 files indexed.'refute_output --partial 'ERROR'run curl "http://localhost:${SOLR_PORT}/solr/monitors_no_type/select?q=*:*"assert_output --partial '"numFound":1'-+solr create -c books_no_type -d _default-- run solr post -url http://localhost:${SOLR_PORT}/solr/books_no_type/update ${SOLR_TIP}/example/exampledocs/books.json++ run solr post --solr-update-url http://localhost:${SOLR_PORT}/solr/books_no_type/update ${SOLR_TIP}/example/exampledocs/books.jsonassert_output --partial '1 files indexed.'refute_output --partial 'ERROR'run curl "http://localhost:${SOLR_PORT}/solr/books_no_type/select?q=*:*"assert_output --partial '"numFound":4'-+solr create -c books_csv_no_type -d _default-- run solr post -url http://localhost:${SOLR_PORT}/solr/books_csv_no_type/update ${SOLR_TIP}/example/exampledocs/books.csv++ run solr post --solr-update-url http://localhost:${SOLR_PORT}/solr/books_csv_no_type/update ${SOLR_TIP}/example/exampledocs/books.csvassert_output --partial '1 files indexed.'refute_output --partial 'ERROR'run curl "http://localhost:${SOLR_PORT}/solr/books_csv_no_type/select?q=*:*"- assert_output --partial '"numFound":10'+ assert_output --partial '"numFound":10'}@test "crawling a directory as a dry-run" {-+# We filter to xml,json,and csv as we don't want to invoke the Extract handler, and are running it as a dry run- run solr post --dry-run -filetypes xml,json,csv -url http://localhost:${SOLR_PORT}/solr/foobar/update -skipcommit ${SOLR_TIP}/example/exampledocs+ run solr post --dry-run --filetypes xml,json,csv --solr-update-url http://localhost:${SOLR_PORT}/solr/foobar/update --skip-commit ${SOLR_TIP}/example/exampledocs- assert_output --partial 'Dry run complete. 16 would have been indexed.'+ assert_output --partial 'Dry run complete. 16 would have been indexed.'refute_output --partial '16 files indexed.'refute_output --partial 'ERROR'}@test "crawling a directory" {-+solr create -c mixed_content -d _default-+# We filter to xml,json,and csv as we don't want to invoke the Extract handler.- run solr post -filetypes xml,json,csv -url http://localhost:${SOLR_PORT}/solr/mixed_content/update ${SOLR_TIP}/example/exampledocs+ run solr post --filetypes xml,json,csv --solr-update-url http://localhost:${SOLR_PORT}/solr/mixed_content/update ${SOLR_TIP}/example/exampledocsassert_output --partial '16 files indexed.'refute_output --partial 'ERROR'@@ -130,7 +130,7 @@ teardown() {# this test doesn't complete due to issues in posting to the /extract handler@test "crawling a web site" {solr create -c webcrawl -d _default-+curl -X POST -H 'Content-type:application/json' -d '{"add-requesthandler": {"name": "/update/extract",@@ -138,17 +138,17 @@ teardown() {"defaults":{ "lowernames": "true", "captureAttr":"true"}}}' "http://localhost:${SOLR_PORT}/solr/webcrawl/config"-- run solr post -mode web --solr-update-url http://localhost:${SOLR_PORT}/webcrawl/update -recursive 1 -delay 1 https://solr.apache.org++ run solr post --mode web --solr-update-url http://localhost:${SOLR_PORT}/webcrawl/update --recursive 1 --delay 1 https://solr.apache.orgassert_output --partial 'Entering crawl at level 0'}@test "skipcommit and optimize and delete" {-+run solr create -c monitors2 -d _defaultassert_output --partial "Created collection 'monitors2'"-- run solr post -url http://localhost:${SOLR_PORT}/solr/monitors2/update -type application/xml -skipcommit -optimize ${SOLR_TIP}/example/exampledocs/monitor.xml++ run solr post --solr-update-url http://localhost:${SOLR_PORT}/solr/monitors2/update --type application/xml --skip-commit --optimize ${SOLR_TIP}/example/exampledocs/monitor.xmlassert_output --partial '1 files indexed.'refute_output --partial 'COMMITting Solr index'@@ -158,22 +158,22 @@ teardown() {}@test "args mode" {-+run solr create -c test_args -d _defaultassert_output --partial "Created collection 'test_args'"-- run solr post -url http://localhost:${SOLR_PORT}/solr/test_args/update -mode args -type application/xml -out "<delete><query>*:*</query></delete>"++ run solr post --solr-update-url http://localhost:${SOLR_PORT}/solr/test_args/update --mode args -type application/xml --out "<delete><query>*:*</query></delete>"assert_output --partial '<int name="status">0</int>'-+# confirm default type- run solr post -url http://localhost:${SOLR_PORT}/solr/test_args/update -mode args -out "{'delete': {'query': '*:*'}}"+ run solr post --solr-update-url http://localhost:${SOLR_PORT}/solr/test_args/update --mode args --out "{'delete': {'query': '*:*'}}"assert_output --partial '"status":0'-+# confirm we don't get back output without -out- run solr post -url http://localhost:${SOLR_PORT}/solr/test_args/update -mode args "{'delete': {'query': '*:*'}}"+ run solr post --solr-update-url http://localhost:${SOLR_PORT}/solr/test_args/update --mode args "{'delete': {'query': '*:*'}}"refute_output --partial '"status":0'-- run solr post -url http://localhost:${SOLR_PORT}/solr/test_args/update -mode args -type text/csv -out $'id,value\nROW1,0.47'++ run solr post --solr-update-url http://localhost:${SOLR_PORT}/solr/test_args/update --mode args --type text/csv --out $'id,value\nROW1,0.47'assert_output --partial '"status":0'run curl "http://localhost:${SOLR_PORT}/solr/test_args/select?q=id:ROW1"assert_output --partial '"numFound":1'@@ -181,14 +181,14 @@ teardown() {# function used because run echo | solr ends up being (run echo) | solr and we loose the output capture.capture_echo_to_solr() {- echo "{'commit': {}}" | solr post -url http://localhost:${SOLR_PORT}/solr/test_stdin/update -mode stdin -type application/json -out+ echo "{'commit': {}}" | solr post --solr-update-url http://localhost:${SOLR_PORT}/solr/test_stdin/update --mode stdin --type application/json --out}@test "stdin mode" {-+run solr create -c test_stdin -d _defaultassert_output --partial "Created collection 'test_stdin'"-+run capture_echo_to_solrassert_output --partial '"status":0'}diff --git a/solr/packaging/test/test_postlogs.bats b/solr/packaging/test/test_postlogs.batsindex 77d80f92c31..6006baecfd0 100644--- a/solr/packaging/test/test_postlogs.bats+++ b/solr/packaging/test/test_postlogs.bats@@ -24,7 +24,7 @@ setup_file() {teardown_file() {common_setup- solr stop -all+ solr stop --all}setup() {diff --git a/solr/packaging/test/test_security_manager.bats b/solr/packaging/test/test_security_manager.batsindex 2de50797ccd..853c1002f07 100644--- a/solr/packaging/test/test_security_manager.bats+++ b/solr/packaging/test/test_security_manager.bats@@ -26,7 +26,7 @@ teardown() {save_home_on_failuredelete_all_collections- SOLR_STOP_WAIT=1 solr stop -all >/dev/null 2>&1+ SOLR_STOP_WAIT=1 solr stop --all >/dev/null 2>&1}@test "allowPaths - backup" {@@ -43,12 +43,12 @@ teardown() {export SOLR_OPTS="-Dsolr.allowPaths=${backup_dir} -Djava.io.tmpdir=${test_tmp_dir}"run solr start -crun solr create -c COLL_NAME- run solr api -get "http://localhost:${SOLR_PORT}/solr/admin/collections?action=BACKUP&name=test&collection=COLL_NAME&location=file://${backup_dir}"+ run solr api --solr-url "http://localhost:${SOLR_PORT}/solr/admin/collections?action=BACKUP&name=test&collection=COLL_NAME&location=file://${backup_dir}"assert_output --partial '"status":0'# Solr is not permissioned for this directory, so it should failbackup_dir_other="${backup_dir}-other"mkdir -p "${backup_dir_other}"- run solr api -get "http://localhost:${SOLR_PORT}/solr/admin/collections?action=BACKUP&name=test-fail&collection=COLL_NAME&location=file://${backup_dir_other}"+ run solr api --solr-url "http://localhost:${SOLR_PORT}/solr/admin/collections?action=BACKUP&name=test-fail&collection=COLL_NAME&location=file://${backup_dir_other}"assert_output --partial 'access denied'}diff --git a/solr/packaging/test/test_ssl.bats b/solr/packaging/test/test_ssl.batsindex b36b18e49ba..08b3fc1d786 100644--- a/solr/packaging/test/test_ssl.bats+++ b/solr/packaging/test/test_ssl.bats@@ -26,7 +26,7 @@ teardown() {save_home_on_failurerun solr auth disable- solr stop -all >/dev/null 2>&1+ solr stop --all >/dev/null 2>&1}@@ -57,7 +57,7 @@ teardown() {run solr create -c test -s 2assert_output --partial "Created collection 'test'"- run solr api -get "https://localhost:${SOLR_PORT}/solr/test/select?q=*:*"+ run solr api --solr-url "https://localhost:${SOLR_PORT}/solr/test/select?q=*:*"assert_output --partial '"numFound":0'run curl --cacert "$ssl_dir/solr-ssl.pem" "https://localhost:${SOLR_PORT}/solr/test/select?q=*:*"@@ -95,7 +95,7 @@ teardown() {run solr create -c test -s 2assert_output --partial "Created collection 'test'"- run solr api -get "https://localhost:${SOLR_PORT}/solr/test/select?q=*:*"+ run solr api --solr-url "https://localhost:${SOLR_PORT}/solr/test/select?q=*:*"assert_output --partial '"numFound":0'# Just test that curl can connect via insecure or via a custom host header@@ -113,7 +113,7 @@ teardown() {export SOLR_SSL_CHECK_PEER_NAME=true# This should fail the peername check- run ! solr api -verbose -get "https://localhost:${SOLR_PORT}/solr/test/select?q=*:*"+ run ! solr api --verbose --solr-url "https://localhost:${SOLR_PORT}/solr/test/select?q=*:*"assert_output --regexp '(No subject alternative DNS name matching localhost found|Server refused connection)'# Restart the server enabling the SNI hostcheck@@ -121,7 +121,7 @@ teardown() {export SOLR_OPTS="${SOLR_OPTS} -Dsolr.jetty.ssl.sniHostCheck=true"solr restart -c# This should fail the SNI Hostname check- run ! solr api -verbose -get "https://localhost:${SOLR_PORT}/solr/admin/collections?action=CLUSTERSTATUS"+ run ! solr api --verbose --solr-url "https://localhost:${SOLR_PORT}/solr/admin/collections?action=CLUSTERSTATUS"assert_output --partial 'Invalid SNI'# Using the right hostname should not fail the SNI Hostname check@@ -153,7 +153,7 @@ teardown() {solr start -csolr assert --started https://localhost:${SOLR_PORT} --timeout 5000- solr auth enable -type basicAuth -credentials name:password+ solr auth enable --type basicAuth --credentials name:passwordrun curl -u name:password --basic --cacert "$ssl_dir/solr-ssl.pem" "https://localhost:${SOLR_PORT}/solr/admin/collections?action=CREATE&collection.configName=_default&name=test&numShards=2&replicationFactor=1&router.name=compositeId&wt=json"assert_output --partial '"status":0'@@ -220,7 +220,7 @@ teardown() {run solr create -c test -s 2assert_output --partial "Created collection 'test'"- run solr api -get "https://localhost:${SOLR_PORT}/solr/admin/collections?action=CLUSTERSTATUS"+ run solr api --solr-url "https://localhost:${SOLR_PORT}/solr/admin/collections?action=CLUSTERSTATUS"assert_output --partial '"urlScheme":"https"'}@@ -338,10 +338,10 @@ teardown() {run solr create -c test -s 2assert_output --partial "Created collection 'test'"- run solr api -get "https://localhost:${SOLR_PORT}/solr/admin/collections?action=CLUSTERSTATUS"+ run solr api --solr-url "https://localhost:${SOLR_PORT}/solr/admin/collections?action=CLUSTERSTATUS"assert_output --partial '"urlScheme":"https"'- run solr api -get "https://localhost:${SOLR2_PORT}/solr/test/select?q=*:*&rows=0"+ run solr api --solr-url "https://localhost:${SOLR2_PORT}/solr/test/select?q=*:*&rows=0"assert_output --partial '"numFound":0'(@@ -349,7 +349,7 @@ teardown() {export SOLR_SSL_CLIENT_KEY_STORE=export SOLR_SSL_CLIENT_KEY_STORE_PASSWORD=- run ! solr api -verbose -get "https://localhost:${SOLR_PORT}/solr/test/select?q=*:*&rows=0"+ run ! solr api --verbose --solr-url "https://localhost:${SOLR_PORT}/solr/test/select?q=*:*&rows=0"assert_output --regexp '(bad_certificate|java.nio.channels.ClosedChannelException|Server refused connection)'))@@ -362,7 +362,7 @@ teardown() {# We can't check if the server has come up, because we can't connect to it, so just waitsleep 5- run ! solr api -verbose -get "https://localhost:${SOLR3_PORT}/solr/test/select?q=*:*&rows=0"+ run ! solr api --verbose --solr-url "https://localhost:${SOLR3_PORT}/solr/test/select?q=*:*&rows=0"assert_output --regexp '(certificate_unknown|java.nio.channels.ClosedChannelException|Server refused connection)'}@@ -475,24 +475,24 @@ teardown() {run solr create -c test -s 2assert_output --partial "Created collection 'test'"- run solr api -get "https://localhost:${SOLR_PORT}/solr/admin/collections?action=CLUSTERSTATUS"+ run solr api --solr-url "https://localhost:${SOLR_PORT}/solr/admin/collections?action=CLUSTERSTATUS"assert_output --partial '"urlScheme":"https"'- run solr api -get "https://localhost:${SOLR2_PORT}/solr/test/select?q=*:*&rows=0"+ run solr api --solr-url "https://localhost:${SOLR2_PORT}/solr/test/select?q=*:*&rows=0"assert_output --partial '"numFound":0'export SOLR_SSL_CLIENT_KEY_STORE=export SOLR_SSL_CLIENT_KEY_STORE_PASSWORD=# mTLS requires a keyStore, so just using the truststore would fail if mTLS was "NEED"ed, however it is only "WANT"ed, so its ok- run solr api -get "https://localhost:${SOLR_PORT}/solr/test/select?q=*:*&rows=0"+ run solr api --solr-url "https://localhost:${SOLR_PORT}/solr/test/select?q=*:*&rows=0"assert_output --partial '"numFound":0'export SOLR_SSL_CLIENT_TRUST_STORE=export SOLR_SSL_CLIENT_TRUST_STORE_PASSWORD=# TLS cannot work if a truststore and keystore are not provided (either Server or Client)- run solr api -verbose -get "https://localhost:${SOLR_PORT}/solr/test/select?q=*:*&rows=0"+ run solr api --verbose --solr-url "https://localhost:${SOLR_PORT}/solr/test/select?q=*:*&rows=0"assert_output --regexp '(unable to find valid certification path to requested target|Server refused connection)'}@@ -543,14 +543,14 @@ teardown() {run solr create -c test-single-shard -s 1assert_output --partial "Created collection 'test-single-shard'"- run solr api -get "https://localhost:${SOLR_PORT}/solr/test/select?q=*:*"+ run solr api --solr-url "https://localhost:${SOLR_PORT}/solr/test/select?q=*:*"assert_output --partial '"numFound":0'- run solr api -get "https://localhost:${SOLR2_PORT}/solr/test/select?q=*:*"+ run solr api --solr-url "https://localhost:${SOLR2_PORT}/solr/test/select?q=*:*"assert_output --partial '"numFound":0'- run solr api -get "https://localhost:${SOLR_PORT}/solr/test-single-shard/select?q=*:*"+ run solr api --solr-url "https://localhost:${SOLR_PORT}/solr/test-single-shard/select?q=*:*"assert_output --partial '"numFound":0'- run solr api -get "https://localhost:${SOLR2_PORT}/solr/test-single-shard/select?q=*:*"+ run solr api --solr-url "https://localhost:${SOLR2_PORT}/solr/test-single-shard/select?q=*:*"assert_output --partial '"numFound":0'run ! curl "https://localhost:${SOLR_PORT}/solr/test/select?q=*:*"@@ -564,7 +564,7 @@ teardown() {export SOLR_SSL_TRUST_STORE=$ssl_dir/cert2.keystore.p12export SOLR_SSL_TRUST_STORE_PASSWORD=secret- run ! solr api -get "https://localhost:${SOLR_PORT}/solr/test/select?q=*:*"+ run ! solr api --solr-url "https://localhost:${SOLR_PORT}/solr/test/select?q=*:*"(cd "$ssl_dir"@@ -574,12 +574,12 @@ teardown() {# Give some time for the server reloadsleep 6- run solr healthcheck -solrUrl https://localhost:${SOLR_PORT}+ run solr healthcheck --solr-url https://localhost:${SOLR_PORT}# Server 2 still uses the cert1, so this request should fail- run ! solr api -get "https://localhost:${SOLR2_PORT}/solr/test/select?q=query2"+ run ! solr api --solr-url "https://localhost:${SOLR2_PORT}/solr/test/select?q=query2"- run ! solr healthcheck -solrUrl https://localhost:${SOLR2_PORT}+ run ! solr healthcheck --solr-url https://localhost:${SOLR2_PORT}(cd "$ssl_dir"@@ -589,23 +589,23 @@ teardown() {# Give some time for the server reloadsleep 6- run solr healthcheck -solrUrl https://localhost:${SOLR_PORT}- run solr healthcheck -solrUrl https://localhost:${SOLR2_PORT}+ run solr healthcheck --solr-url https://localhost:${SOLR_PORT}+ run solr healthcheck --solr-url https://localhost:${SOLR2_PORT}- run solr api -get "https://localhost:${SOLR_PORT}/solr/test/select?q=query3"+ run solr api --solr-url "https://localhost:${SOLR_PORT}/solr/test/select?q=query3"assert_output --partial '"numFound":0'- run solr api -get "https://localhost:${SOLR2_PORT}/solr/test/select?q=query3"+ run solr api --solr-url "https://localhost:${SOLR2_PORT}/solr/test/select?q=query3"assert_output --partial '"numFound":0'- run solr api -get "https://localhost:${SOLR_PORT}/solr/test-single-shard/select?q=query4"+ run solr api --solr-url "https://localhost:${SOLR_PORT}/solr/test-single-shard/select?q=query4"assert_output --partial '"numFound":0'- run solr api -get "https://localhost:${SOLR2_PORT}/solr/test-single-shard/select?q=query4"+ run solr api --solr-url "https://localhost:${SOLR2_PORT}/solr/test-single-shard/select?q=query4"assert_output --partial '"numFound":0'run solr post -url https://localhost:${SOLR_PORT}/solr/test/update ${SOLR_TIP}/example/exampledocs/books.csv- run solr api -get "https://localhost:${SOLR_PORT}/solr/test/select?q=*:*"+ run solr api --solr-url "https://localhost:${SOLR_PORT}/solr/test/select?q=*:*"assert_output --partial '"numFound":10'}diff --git a/solr/packaging/test/test_start_solr.bats b/solr/packaging/test/test_start_solr.batsindex 6cafa120222..170aeccc02d 100644--- a/solr/packaging/test/test_start_solr.bats+++ b/solr/packaging/test/test_start_solr.bats@@ -25,7 +25,7 @@ teardown() {# save a snapshot of SOLR_HOME for failed testssave_home_on_failure- solr stop -all >/dev/null 2>&1+ solr stop --all >/dev/null 2>&1}@test "SOLR-11740 check 'solr stop' connection" {@@ -33,7 +33,7 @@ teardown() {solr start -p ${SOLR2_PORT}solr assert --started http://localhost:${SOLR_PORT} --timeout 5000solr assert --started http://localhost:${SOLR2_PORT} --timeout 5000- run bash -c 'solr stop -all 2>&1'+ run bash -c 'solr stop --all 2>&1'refute_output --partial 'forcefully killing'}@@ -43,7 +43,7 @@ teardown() {solr start -p ${SOLR2_PORT}solr assert --started http://localhost:${SOLR_PORT} --timeout 5000solr assert --started http://localhost:${SOLR2_PORT} --timeout 5000-+run solr stop -p ${SOLR2_PORT}solr assert --not-started http://localhost:${SOLR2_PORT} --timeout 5000solr assert --started http://localhost:${SOLR_PORT} --timeout 5000diff --git a/solr/packaging/test/test_status.bats b/solr/packaging/test/test_status.batsindex ad471464f92..f599bc8e5e6 100644--- a/solr/packaging/test/test_status.bats+++ b/solr/packaging/test/test_status.bats@@ -25,7 +25,7 @@ teardown() {# save a snapshot of SOLR_HOME for failed testssave_home_on_failure- solr stop -all >/dev/null 2>&1+ solr stop --all >/dev/null 2>&1}@test "status detects locally running solr" {@@ -40,16 +40,15 @@ teardown() {}-@test "status shell script ignores passed in -solrUrl cli parameter from user" {+@test "status shell script ignores passed in --solr-url cli parameter from user" {solr start- run solr status -solrUrl http://localhost:9999- assert_output --partial "needn't include Solr's context-root"+ run solr status --solr-url http://localhost:9999assert_output --partial "Found 1 Solr nodes:"assert_output --partial "running on port ${SOLR_PORT}"}-@test "status help flag outputs message highlighting not to use solrUrl." {- run solr status -help+@test "status help flag outputs message highlighting not to use solr-url." {+ run solr status --helpassert_output --partial 'usage: status'refute_output --partial 'ERROR'}diff --git a/solr/packaging/test/test_zk.bats b/solr/packaging/test/test_zk.batsindex 00ad93d1c87..1c2c2a2bad7 100644--- a/solr/packaging/test/test_zk.bats+++ b/solr/packaging/test/test_zk.bats@@ -24,7 +24,7 @@ setup_file() {teardown_file() {common_setup- solr stop -all+ solr stop --all}setup() {@@ -47,10 +47,34 @@ teardown() {assert_output --partial "aliases.json"}-@test "get zk host using solr url" {+@test "connecting to solr via various solr urls and zk hosts" {sleep 1run solr zk ls / -solrUrl http://localhost:${SOLR_PORT}assert_output --partial "aliases.json"+ # We do mapping in bin/solr script from -solrUrl to --solr-url that prevents deprecation warning+ #assert_output --partial "Deprecated for removal since 9.7: Use --solr-url instead"++ run solr zk ls / -s http://localhost:${SOLR_PORT}+ assert_output --partial "aliases.json"+ # We do mapping in bin/solr script from -solrUrl to --solr-url that prevents deprecation warning+ #assert_output --partial "Deprecated for removal since 9.7: Use --solr-url instead"++ run solr zk ls / --solr-url http://localhost:${SOLR_PORT}+ assert_output --partial "aliases.json"++ run solr zk ls /+ assert_output --partial "aliases.json"++ run solr zk ls / -z localhost:${ZK_PORT}+ assert_output --partial "aliases.json"++ run solr zk ls / --zk-host localhost:${ZK_PORT}+ assert_output --partial "aliases.json"++ run solr zk ls / -zkHost localhost:${ZK_PORT}+ assert_output --partial "aliases.json"+ # We do mapping in bin/solr script from -zkHost to --zk-host that prevents deprecation warning+ #assert_output --partial "Deprecated for removal since 9.7: Use --zk-host instead"}@test "copying files around" {@@ -67,7 +91,7 @@ teardown() {sleep 1run solr zk ls / -z localhost:${ZK_PORT}assert_output --partial "myfile2.txt"-+touch myfile3.txtrun solr zk cp myfile3.txt zk:/myfile3.txt -z localhost:${ZK_PORT}assert_output --partial "Copying from 'myfile3.txt' to 'zk:/myfile3.txt'. ZooKeeper at localhost:${ZK_PORT}"@@ -97,14 +121,14 @@ teardown() {@test "bin/solr zk cp gets 'solrhome' from '--solr-home' command line option" {touch afile.txt-+run solr zk cp afile.txt zk:/afile.txt -z localhost:${ZK_PORT} -verbose --solr-home ${SOLR_TIP}/server/solrassert_output --partial "Using SolrHome: ${SOLR_TIP}/server/solr"refute_output --partial 'Failed to load solr.xml from ZK or SolrHome'-+# The -DminStateByteLenForCompression variable substitution on solr start is not seen# by the ZkCpTool.java, so therefore we do not have compression unless solr.xml is directly edited.#assert_output --partial 'Compression of state.json has been enabled'-+rm afile.txt}diff --git a/solr/packaging/test/test_zz_cleanup.bats b/solr/packaging/test/test_zz_cleanup.batsindex 1700f53e53a..0272158b4f0 100644--- a/solr/packaging/test/test_zz_cleanup.bats+++ b/solr/packaging/test/test_zz_cleanup.bats@@ -31,7 +31,7 @@ setup() {@test "Cleanup" {sleep 1- run solr stop -all- run solr status -maxWaitSecs 10+ run solr stop --all+ run solr status --max-wait-secs 10assert_output --partial "No Solr nodes are running"}diff --git a/solr/prometheus-exporter/src/java/org/apache/solr/prometheus/exporter/SolrExporter.java b/solr/prometheus-exporter/src/java/org/apache/solr/prometheus/exporter/SolrExporter.javaindex 57b5c52e6e9..73aec2c567f 100644--- a/solr/prometheus-exporter/src/java/org/apache/solr/prometheus/exporter/SolrExporter.java+++ b/solr/prometheus-exporter/src/java/org/apache/solr/prometheus/exporter/SolrExporter.java@@ -58,7 +58,7 @@ public class SolrExporter {private static final String ARG_BASE_URL_HELP ="Specify the Solr base URL when connecting to Solr in standalone mode. If omitted both the -b parameter and the -z parameter, connect to http://localhost:8983/solr. For example 'http://localhost:8983/solr'.";- private static final String[] ARG_ZK_HOST_FLAGS = {"-z", "--zkhost"};+ private static final String[] ARG_ZK_HOST_FLAGS = {"-z", "--zk-host"};private static final String ARG_ZK_HOST_METAVAR = "ZK_HOST";private static final String ARG_ZK_HOST_DEST = "zkHost";private static final String ARG_ZK_HOST_DEFAULT = "";diff --git a/solr/server/solr/zoo.cfg b/solr/server/solr/zoo.cfgindex 7c32425e718..621506c616d 100644--- a/solr/server/solr/zoo.cfg+++ b/solr/server/solr/zoo.cfg@@ -31,4 +31,4 @@ syncLimit=5#autopurge.purgeInterval=1# Disable ZK AdminServer since we do not use it-admin.enableServer=false\ No newline at end of file+admin.enableServer=falsediff --git a/solr/solr-ref-guide/modules/configuration-guide/pages/configuring-solr-xml.adoc b/solr/solr-ref-guide/modules/configuration-guide/pages/configuring-solr-xml.adocindex 22e8d8a7071..b999a8fb82e 100644--- a/solr/solr-ref-guide/modules/configuration-guide/pages/configuring-solr-xml.adoc+++ b/solr/solr-ref-guide/modules/configuration-guide/pages/configuring-solr-xml.adoc@@ -366,7 +366,7 @@ By default, Solr will hide all basicAuth, AWS, ZK or SSL secret sysProps. It wil=== The <solrcloud> ElementThis element defines several parameters that relate so SolrCloud.-This section is ignored unless theSolr instance is started with either `-DzkRun` or `-DzkHost`+This section is ignored unless the Solr instance is started with either `-DzkRun` or `-DzkHost``distribUpdateConnTimeout`::+diff --git a/solr/solr-ref-guide/modules/configuration-guide/pages/package-manager.adoc b/solr/solr-ref-guide/modules/configuration-guide/pages/package-manager.adocindex 92b7835cac3..f7e37aa77c4 100644--- a/solr/solr-ref-guide/modules/configuration-guide/pages/package-manager.adoc+++ b/solr/solr-ref-guide/modules/configuration-guide/pages/package-manager.adoc@@ -102,7 +102,7 @@ There are two ways to do this: either use the CLI's `deploy` command or manuallyIf the package author states support for it, the package can be deployed with the CLI's `deploy` command.[source,bash]-----$ bin/solr package deploy <package-name>:[version] -collections <collection1>[,<collection2>,...] [-p <param1>=<val1> -p <param2>=<val2> ...+$ bin/solr package deploy <package-name>:[version] --collections <collection1>[,<collection2>,...] [-p <param1>=<val1> -p <param2>=<val2> ...----ordiff --git a/solr/solr-ref-guide/modules/deployment-guide/pages/enabling-ssl.adoc b/solr/solr-ref-guide/modules/deployment-guide/pages/enabling-ssl.adocindex 1601ee652df..b67760d3164 100644--- a/solr/solr-ref-guide/modules/deployment-guide/pages/enabling-ssl.adoc+++ b/solr/solr-ref-guide/modules/deployment-guide/pages/enabling-ssl.adoc@@ -305,7 +305,7 @@ If you created the SSL key without all DNS names or IP addresses on which Solr n[.tab-label]*\*nix*[source,terminal]-----$ bin/solr start -cloud -s cloud/node1 -z server1:2181,server2:2181,server3:2181 -p 8984+$ bin/solr start --cloud -s cloud/node1 -z server1:2181,server2:2181,server3:2181 -p 8984----====@@ -314,7 +314,7 @@ $ bin/solr start -cloud -s cloud/node1 -z server1:2181,server2:2181,server3:2181[.tab-label]*Windows*[source,powershell]-----C:\> bin\solr.cmd -cloud -s cloud\node1 -z server1:2181,server2:2181,server3:2181+C:\> bin\solr.cmd --cloud -s cloud\node1 -z server1:2181,server2:2181,server3:2181----====@@ -362,13 +362,13 @@ Create a 2-shard, replicationFactor=1 collection named mycollection using the `_.*nix command[source,bash]-----bin/solr create -c mycollection -shards 2+bin/solr create -c mycollection --shards 2----.Windows command[source,text]-----bin\solr.cmd create -c mycollection -shards 2+bin\solr.cmd create -c mycollection --shards 2----The `create` action will pass the `SOLR_SSL_*` properties set in your include file to the SolrJ code used to create the collection.diff --git a/solr/solr-ref-guide/modules/deployment-guide/pages/installing-solr.adoc b/solr/solr-ref-guide/modules/deployment-guide/pages/installing-solr.adocindex 7889c4e0863..45a3de05b3e 100644--- a/solr/solr-ref-guide/modules/deployment-guide/pages/installing-solr.adoc+++ b/solr/solr-ref-guide/modules/deployment-guide/pages/installing-solr.adoc@@ -238,5 +238,5 @@ To see all available options for creating a new core, execute:[source,bash]-----bin/solr create -help+bin/solr create --help----diff --git a/solr/solr-ref-guide/modules/deployment-guide/pages/monitoring-with-prometheus-and-grafana.adoc b/solr/solr-ref-guide/modules/deployment-guide/pages/monitoring-with-prometheus-and-grafana.adocindex 3ed5b081cda..ee5ca30b915 100644--- a/solr/solr-ref-guide/modules/deployment-guide/pages/monitoring-with-prometheus-and-grafana.adoc+++ b/solr/solr-ref-guide/modules/deployment-guide/pages/monitoring-with-prometheus-and-grafana.adoc@@ -121,7 +121,7 @@ The Solr base URL (such as `\http://localhost:8983/solr`) when Solr is running iIf you are running SolrCloud, do not specify this parameter.If neither the `-b` parameter nor the `-z` parameter are defined, the default is `-b \http://localhost:8983/solr`.-`-z`, `--zkhost`, `$ZK_HOST`::+`-z`, `--zk-host`, `$ZK_HOST`::+[%autowidth,frame=none]|===diff --git a/solr/solr-ref-guide/modules/deployment-guide/pages/security-ui.adoc b/solr/solr-ref-guide/modules/deployment-guide/pages/security-ui.adocindex a5fa8a9df54..4691083f7df 100644--- a/solr/solr-ref-guide/modules/deployment-guide/pages/security-ui.adoc+++ b/solr/solr-ref-guide/modules/deployment-guide/pages/security-ui.adoc@@ -33,7 +33,7 @@ When first getting started with Solr, use the `bin/solr auth` command-line utiliFor example, the following command will enable *basic authentication* and prompt you for the username and password for the initial user with administrative access:[source,bash]----- bin/solr auth enable -type basicAuth -prompt true -z localhost:2181+ bin/solr auth enable --type basicAuth --prompt true -z localhost:2181----_Note: The `auth` utility only works with Solr running in cloud mode and thus requires a Zookeeper connection string passed via the `-z` option._diff --git a/solr/solr-ref-guide/modules/deployment-guide/pages/solr-control-script-reference.adoc b/solr/solr-ref-guide/modules/deployment-guide/pages/solr-control-script-reference.adocindex 4bcfc353160..9a0d0f87b42 100644--- a/solr/solr-ref-guide/modules/deployment-guide/pages/solr-control-script-reference.adoc+++ b/solr/solr-ref-guide/modules/deployment-guide/pages/solr-control-script-reference.adoc@@ -36,11 +36,11 @@ The `start` and `restart` commands have several options to allow you to run in S`bin/solr start [options]`-`bin/solr start -help`+`bin/solr start --help``bin/solr restart [options]`-`bin/solr restart -help`+`bin/solr restart --help`When using the `restart` command, you must pass all of the parameters you initially passed when you started Solr.Behind the scenes, a stop request is initiated, so Solr will be stopped before being started again.@@ -80,7 +80,7 @@ Additional parameters to pass to Jetty when starting Solr.For example, to add configuration folder that Jetty should read you could pass: `-j "--include-jetty-dir=/etc/jetty/custom/server/"`.In most cases, you should wrap the additional parameters in double quotes.-`-cloud` or `-c`::+`--cloud` or `-c`::+[%autowidth,frame=none]|===@@ -142,7 +142,7 @@ You cannot use this option when running examples with the `-e` option.+*Example*: `bin/solr start -f`-`-host <hostname>`::+`--host <hostname>`::+[%autowidth,frame=none]|===@@ -152,7 +152,7 @@ You cannot use this option when running examples with the `-e` option.Specify the hostname for this Solr instance.If this is not specified, `localhost` is assumed.+-*Example*: `bin/solr start -host search.mysolr.com`+*Example*: `bin/solr start --host search.mysolr.com``-m <memory>`::+@@ -165,7 +165,7 @@ Sets the min (`-Xms`) and max (`-Xmx`) heap size for the JVM running Solr.+*Example*: `bin/solr start -m 4g` results in `-Xms4g -Xmx4g` settings.-`-noprompt`::+`--no-prompt`::+[%autowidth,frame=none]|===@@ -175,9 +175,9 @@ Sets the min (`-Xms`) and max (`-Xmx`) heap size for the JVM running Solr.Don't prompt for input; accept all defaults when running examples that accept user input.+For example, when using the "cloud" example, an interactive session guides you through several options for your SolrCloud cluster.-If you want to accept all of the defaults, you can simply add the `-noprompt` option to your request.+If you want to accept all of the defaults, you can simply add the `--no-prompt` option to your request.+-*Example*: `bin/solr start -e cloud -noprompt`+*Example*: `bin/solr start -e cloud --no-prompt``-p <port>`::+@@ -213,7 +213,7 @@ If passed relative dir, validation with current dir will be done, before trying+*Example*: `bin/solr start -s newHome`-`-t <dir>`::+`-t <dir>` or `--data-home <dir>`::+[%autowidth,frame=none]|===@@ -259,7 +259,7 @@ Verbose messages from this script.+*Example*: `bin/solr start -V`-`-z <zkHost>` or `-zkHost <zkHost>`::+`-z <zkHost>` or `--zk-host <zkHost>`::+[%autowidth,frame=none]|===@@ -314,11 +314,11 @@ the `SOLR_TOOL_OPTS` environment variable should be used.==== SolrCloud Mode-The `-c` and `-cloud` options are equivalent:+The `-c` and `--cloud` options are equivalent:`bin/solr start -c`-`bin/solr start -cloud`+`bin/solr start --cloud`If you specify a ZooKeeper connection string, such as `-z 192.168.1.4:2181`, then Solr will connect to ZooKeeper and join the cluster.@@ -388,7 +388,7 @@ The command will wait up to 180 seconds for Solr to stop gracefully and then wil`bin/solr stop [options]`-`bin/solr stop -help`+`bin/solr stop --help`==== Stop Parameters@@ -404,7 +404,7 @@ If you are running more than one instance, or are running in SolrCloud mode, you+*Example*: `bin/solr stop -p 8983`-`-all`::+`--all`::+[%autowidth,frame=none]|===@@ -413,7 +413,7 @@ If you are running more than one instance, or are running in SolrCloud mode, you+Find and stop all running Solr servers on this host that have a valid PID.+-*Example*: `bin/solr stop -all`+*Example*: `bin/solr stop --all``-k <key>`::+@@ -511,7 +511,7 @@ The basic usage of `bin/solr assert` is:$ bin/solr assert -husage: bin/solr assert [-m <message>] [-e] [-rR] [-s <url>] [-S <url>] [-c<url>] [-C <url>] [-u <dir>] [-x <dir>] [-X <dir>]- -c,--cloud <url> Asserts that Solr is running in cloud mode.+ -c,---cloud <url> Asserts that Solr is running in cloud mode.Also fails if Solr not running. URL shouldbe for root Solr path.-C,--not-cloud <url> Asserts that Solr is not running in cloud@@ -519,7 +519,7 @@ usage: bin/solr assert [-m <message>] [-e] [-rR] [-s <url>] [-S <url>] [-cshould be for root Solr path.-e,--exitcode Return an exit code instead of printingerror message on assert fail.- -help Print this message+ -h,--help Print this message.-m,--message <message> Exception message to be used in place ofthe default error message.-R,--not-root Asserts that we are NOT the root user.@@ -532,11 +532,11 @@ usage: bin/solr assert [-m <message>] [-e] [-rR] [-s <url>] [-S <url>] [-ctimeout.-u,--same-user <directory> Asserts that we run as same user that owns<directory>.- -verbose Enable more verbose command output.+ -v,--verbose Enable more verbose command output.-x,--exists <directory> Asserts that directory <directory> exists.-X,--not-exists <directory> Asserts that directory <directory> does NOTexist.- --credentials <user:pass> Username and password for Basic authentication.+ -u,--credentials <user:pass> Username and password for Basic authentication.----=== Healthcheck@@ -546,7 +546,7 @@ The health report provides information about the state of every replica for all`bin/solr healthcheck [options]`-`bin/solr healthcheck -help`+`bin/solr healthcheck --help`==== Healthcheck Parameters@@ -561,7 +561,7 @@ Name of the collection to run a healthcheck against.+*Example*: `bin/solr healthcheck -c gettingstarted`-`-solrUrl <url>`::+`--solr-url <url>`::+[%autowidth,frame=none]|===@@ -570,7 +570,7 @@ Name of the collection to run a healthcheck against.+Base Solr URL, which can be used in SolrCloud mode to determine the ZooKeeper connection string if that's not known.-`-z <zkhost>` or `-zkHost <zkhost>`::+`-z <zkhost>` or `--zk-host <zkhost>`::+[%autowidth,frame=none]|===@@ -656,7 +656,7 @@ The `create` command creates a core or collection depending on whether Solr is r`bin/solr create [options]`-`bin/solr create -help`+`bin/solr create --help`==== Create Core or Collection Parameters@@ -671,7 +671,7 @@ Name of the core or collection to create.+*Example*: `bin/solr create -c mycollection`-`-d <confdir>`::+`-d <confdir>` or `--conf-dir <confdir>`::::+[%autowidth,frame=none]|===@@ -708,7 +708,7 @@ Only applies when Solr is running in SolrCloud mode.+*Example*: `bin/solr create -s 2`-`-rf <replicas>` or `-replicationFactor <replicas>`::+`-rf <replicas>` or `--replication-factor <replicas>`::+[%autowidth,frame=none]|===@@ -730,9 +730,9 @@ The default is `1` (no replication).If attempting to run create as "root" user, the script will exit with a warning that running Solr or actions against Solr as "root" can cause problems.It is possible to override this warning with the -force parameter.+-*Example*: `bin/solr create -c foo -force`+*Example*: `bin/solr create -c foo --force`-`-z <zkHost>` or `-zkHost <zkHost>`::+`-z <zkHost>` or `-zk-host <zkHost>`::+[%autowidth,frame=none]|===@@ -742,7 +742,7 @@ It is possible to override this warning with the -force parameter.The ZooKeeper connection string, usable in SolrCloud mode.Unnecessary if `ZK_HOST` is defined in `solr.in.sh` or `solr.in.cmd`.-`-solrUrl <url>`::+`--solr-url <url>`::+[%autowidth,frame=none]|===@@ -799,7 +799,7 @@ Consequently, we recommend that you do not share data-driven configurations betwYou can turn off schemaless functionality for a collection with the following command, assuming the collection name is `mycollection`.[source,bash]-$ bin/solr config -c mycollection -action set-user-property -property update.autoCreateFields -value false+$ bin/solr config -c mycollection --action set-user-property --property update.autoCreateFields --value falseSee also the section <<Set or Unset Configuration Properties>>.@@ -809,7 +809,7 @@ The `delete` command detects the mode that Solr is running in and then deletes t`bin/solr delete [options]`-`bin/solr delete -help`+`bin/solr delete --help`If you're deleting a collection in SolrCloud mode, the default behavior is to also delete the configuration directory from Zookeeper so long as it is not being used by another collection.@@ -829,7 +829,7 @@ Name of the core or collection to delete.+*Example*: `bin/solr delete -c mycoll`-`-deleteConfig`::+`--delete-config`::+[%autowidth,frame=none]|===@@ -838,11 +838,11 @@ Name of the core or collection to delete.+Whether or not the configuration directory should also be deleted from ZooKeeper.+-If the configuration directory is being used by another collection, then it will not be deleted even if you pass `-deleteConfig` as `true`.+If the configuration directory is being used by another collection, then it will not be deleted even if you pass `--deleteConfig` as `true`.+-*Example*: `bin/solr delete -deleteConfig false`+*Example*: `bin/solr delete --delete-config false`-`-forceDeleteConfig`::+`--force-delete-config`::+[%autowidth,frame=none]|===@@ -851,7 +851,7 @@ If the configuration directory is being used by another collection, then it will+Skip safety checks when deleting the configuration directory used by a collection.-`-z <zkHost>` or `-zkHost <zkHost>`::+`-z <zkHost>` or `--zk-host <zkHost>`::+[%autowidth,frame=none]|===@@ -861,7 +861,7 @@ Skip safety checks when deleting the configuration directory used by a collectioThe ZooKeeper connection string, usable in SolrCloud mode.Unnecessary if `ZK_HOST` is defined in `solr.in.sh` or `solr.in.cmd`.-`-solrUrl <url>`::+`-solr-url <url>`::+[%autowidth,frame=none]|===@@ -884,10 +884,10 @@ This parameter is unnecessary if `SOLR_AUTH_TYPE` is defined in `solr.in.sh` orThe `bin/solr` script allows enabling or disabling Authentication, allowing you to configure authentication from the command line.-Currently this command is only available when using SolrCloud mode and must be run on the machine hosting Solr.+Currently this command is only available when using SolrCloud mode and must be run on the machine hosting Solr.For Basic Authentication the script provides https://github.com/apache/solr/blob/main/solr/core/resources/security.json[user roles and permission mappings], and maps the created user to the `superadmin` role.-For Kerberos it only enables the security.json, it doesn't set up any users or role mappings.+For Kerberos it only enables the security.json, it doesn't set up any users or role mappings.=== Enabling Basic Authentication@@ -915,10 +915,10 @@ Here are some example usages:[source,plain]-----Usage: solr auth enable [-type basicAuth] -credentials user:pass [-blockUnknown <true|false>] [-updateIncludeFileOnly <true|false>] [-V]- solr auth enable [-type basicAuth] -prompt <true|false> [-blockUnknown <true|false>] [-updateIncludeFileOnly <true|false>] [-V]- solr auth enable -type kerberos -config <kerberos configs> [-updateIncludeFileOnly <true|false>] [-V]- solr auth disable [-updateIncludeFileOnly <true|false>] [-V]+Usage: solr auth enable [--type basicAuth] --credentials user:pass [--block-unknown <true|false>] [--update-include-file-only <true|false>] [-v]+ solr auth enable [--type basicAuth] --prompt <true|false> [--block-unknown <true|false>] [--update-include-file-only <true|false>] [-v]+ solr auth enable --type kerberos --config <kerberos configs> [--update-include-file-only <true|false>] [-v]+ solr auth disable [--update-include-file-only <true|false>] [-v]----@@ -949,7 +949,7 @@ Prompts the user to provide the credentials. If prompt is preferred, pass `true`+Either `-credentials` or `-prompt` *must* be specified.-`-blockUnknown <true|false>`::+`--block-unknown <true|false>`::+[%autowidth,frame=none]|===@@ -977,7 +977,7 @@ If not specified this script looks for an include file named solr.in.sh to set e* `/var/solr`* `/opt/solr`-`-updateIncludeFileOnly <true|false>`::+`--update-include-file-only <true|false>`::+[%autowidth,frame=none]|===@@ -986,7 +986,7 @@ If not specified this script looks for an include file named solr.in.sh to set e+When `true`, only update the `bin/solr.in.sh` or `bin\solr.in.cmd`, and skip actual enabling/disabling authentication (i.e. don't update `security.json`).-`-z <zkHost>` or `-zkHost <zkHost>`::+`-z <zkHost>` or `-zk-host <zkHost>`::+[%autowidth,frame=none]|===@@ -1007,7 +1007,7 @@ Unnecessary if `ZK_HOST` is defined in `solr.in.sh` or `solr.in.cmd`.Defines the Solr server directory, by default `$SOLR_TIP/server`.It is not common to need to override the default, and is only needed if you have customized the `$SOLR_HOME` directory path.-`-s <dir>` or `-solr.home <dir>`::+`-s <dir>` or `--solr-home <dir>`::+[%autowidth,frame=none]|===@@ -1022,9 +1022,9 @@ This is where any credentials or authentication configuration files (e.g. basicAYou can disable Basic Authentication with `bin/solr auth disable`.-If the `-updateIncludeFileOnly` option is set to *true*, then only the settings in `bin/solr.in.sh` or `bin\solr.in.cmd` will be updated, and `security.json` will not be removed.+If the `--update-include-file-only` option is set to *true*, then only the settings in `bin/solr.in.sh` or `bin\solr.in.cmd` will be updated, and `security.json` will not be removed.-If the `-updateIncludeFileOnly` option is set to *false*, then the settings in `bin/solr.in.sh` or `bin\solr.in.cmd` will be updated, and `security.json` will be removed.+If the `--update-include-file-only` option is set to *false*, then the settings in `bin/solr.in.sh` or `bin\solr.in.cmd` will be updated, and `security.json` will be removed.However, the `basicAuth.conf` file is not removed with either option.== Set or Unset Configuration Properties@@ -1033,35 +1033,35 @@ The `bin/solr` script enables a subset of the Config API: xref:configuration-gui`bin/solr config [options]`-`bin/solr config -help`+`bin/solr config --help`=== Set or Unset Common PropertiesTo set the common property `updateHandler.autoCommit.maxDocs` to `100` on collection `mycollection`:-`bin/solr config -c mycollection -action set-property -property updateHandler.autoCommit.maxDocs -value 100`+`bin/solr config -c mycollection --action set-property --property updateHandler.autoCommit.maxDocs --value 100`-The default `-action` is `set-property`, so the above can be shortened by not mentioning it:+The default `--action` is `set-property`, so the above can be shortened by not mentioning it:-`bin/solr config -c mycollection -property updateHandler.autoCommit.maxDocs -value 100`+`bin/solr config -c mycollection --property updateHandler.autoCommit.maxDocs --value 100`-To unset a previously set common property, specify `-action unset-property` with no `-value`:+To unset a previously set common property, specify `--action unset-property` with no `--value`:-`bin/solr config -c mycollection -action unset-property -property updateHandler.autoCommit.maxDocs`+`bin/solr config -c mycollection --action unset-property --property updateHandler.autoCommit.maxDocs`=== Set or Unset User-Defined PropertiesTo set the user-defined property `update.autoCreateFields` to `false` (to disable xref:indexing-guide:schemaless-mode.adoc[]):-`bin/solr config -c mycollection -action set-user-property -property update.autoCreateFields -value false`+`bin/solr config -c mycollection --action set-user-property --property update.autoCreateFields --value false`-To unset a previously set user-defined property, specify `-action unset-user-property` with no `-value`:+To unset a previously set user-defined property, specify `--action unset-user-property` with no `--value`:-`bin/solr config -c mycollection -action unset-user-property -property update.autoCreateFields`+`bin/solr config -c mycollection --action unset-user-property --property update.autoCreateFields`=== Config Parameters-`-c <name>` or `-name <name>`::+`-c <name>` or `--name <name>`::+[%autowidth,frame=none]|===@@ -1070,7 +1070,7 @@ s|Required |Default: none+Name of the core or collection on which to change configuration.-`-action <name>`::+`--action <name>`::+[%autowidth,frame=none]|===@@ -1079,7 +1079,7 @@ Name of the core or collection on which to change configuration.+Config API action, one of: `set-property`, `unset-property`, `set-user-property`, `unset-user-property`.-`-property <name>`::+`--property <name>`::+[%autowidth,frame=none]|===@@ -1088,7 +1088,7 @@ s|Required |Default: none+Name of the Config API property to apply the action to, such as: 'updateHandler.autoSoftCommit.maxTime'.-`-value <new-value>`::+`--value <new-value>`::+[%autowidth,frame=none]|===@@ -1097,7 +1097,7 @@ Name of the Config API property to apply the action to, such as: 'updateHandler.+Set the property to this value; accepts JSON objects and strings.-`-z <zkHost>` or `-zkHost <zkHost>`::+`-z <zkHost>` or `--zk-host <zkHost>`::+[%autowidth,frame=none]|===@@ -1107,7 +1107,7 @@ Set the property to this value; accepts JSON objects and strings.The ZooKeeper connection string, usable in SolrCloud mode.Unnecessary if `ZK_HOST` is defined in `solr.in.sh` or `solr.in.cmd`.-`-solrUrl <url>`::+`-u <url>` or --solr-url <url>`::+[%autowidth,frame=none]|===@@ -1145,7 +1145,7 @@ The operations are available as sub-commands, which each have their own set of o`bin/solr zk [sub-command] [options]`-`bin/solr zk -help`+`bin/solr zk --help`The basic usage of bin/solr zk is:@@ -1206,7 +1206,7 @@ An absolute path may be supplied instead.* `-d directory_under_configsets`* `-d /path/to/configset/source`-`-z <zkHost>`::+`-z <zkHost>` or `--zk-host <zkHost>`::+[%autowidth,frame=none]|===@@ -1218,7 +1218,7 @@ Is not required if `ZK_HOST` is defined in `solr.in.sh` or `solr.in.cmd`.+*Example*: `-z 123.321.23.43:2181`-`-solrUrl <url>`::+`-url <url>` or `--solr-url <url>`::+[%autowidth,frame=none]|===@@ -1278,7 +1278,7 @@ In either case, _pre-existing configurations at the destination will be overwrit* `-d directory_under_configsets`* `-d /path/to/configset/destination`-`-z <zkHost>`::+`-z <zkHost>` or `--zk-host <zkHost>`::+[%autowidth,frame=none]|===@@ -1290,7 +1290,7 @@ Unnecessary if `ZK_HOST` is defined in `solr.in.sh` or `solr.in.cmd`.+*Example*: `-z 123.321.23.43:2181`-`-solrUrl <url>`::+`-url <url>` or `--solr-url <url>`::+[%autowidth,frame=none]|===@@ -1362,7 +1362,7 @@ If `<dest>` ends in a slash character it names a directory.* `zk:/configs/myconfigs/solrconfig.xml`* `file:/Users/apache/configs/src`-`-z <zkHost>`::+`-z <zkHost>` or `--zk-host <zkHost>`::+[%autowidth,frame=none]|===@@ -1374,7 +1374,7 @@ Optional if `ZK_HOST` is defined in `solr.in.sh` or `solr.in.cmd`.+*Example*: `-z 123.321.23.43:2181`-`-solrUrl <url>`::+`-url <url>` or `--solr-url <url>`::+[%autowidth,frame=none]|===@@ -1445,7 +1445,7 @@ The path is assumed to be a ZooKeeper node, no `zk:` prefix is necessary.* `/configs/myconfigset`* `/configs/myconfigset/solrconfig.xml`-`-z <zkHost>`::+`-z <zkHost>` or `--zk-host <zkHost>`::+[%autowidth,frame=none]|===@@ -1457,7 +1457,7 @@ Optional if `ZK_HOST` is defined in `solr.in.sh` or `solr.in.cmd`.+*Example*: `-z 123.321.23.43:2181`-`-solrUrl <url>`::+`-url <url>` or `--solr-url <url>`::+[%autowidth,frame=none]|===@@ -1503,7 +1503,7 @@ The `zk:` prefix is assumed.+*Example*: `/configs/newconfigset`-`-z <zkHost>`::+`-z <zkHost>` or `--zk-host <zkHost>`::+[%autowidth,frame=none]|===@@ -1519,7 +1519,7 @@ An example of this command is:`bin/solr zk mv /configs/oldconfigset /configs/newconfigset`-`-solrUrl <url>`::+`-url <url>` or `--solr-url <url>`::+[%autowidth,frame=none]|===@@ -1558,7 +1558,7 @@ The path on ZooKeeper to list.+*Example*: `/collections/mycollection`-`-z <zkHost>`::+`-z <zkHost>` or `--zk-host <zkHost>`::+[%autowidth,frame=none]|===@@ -1570,7 +1570,7 @@ Optional if `ZK_HOST` is defined in `solr.in.sh` or `solr.in.cmd`.+*Example*: `-z 123.321.23.43:2181`-`-solrUrl <url>`::+`-url <url>` or `--solr-url <url>`::+[%autowidth,frame=none]|===@@ -1607,7 +1607,7 @@ A leading slash is assumed if not present.+*Example*: `/solr`-`-z <zkHost>`::+`-z <zkHost>` or `--zk-host <zkHost>`::+[%autowidth,frame=none]|===@@ -1619,7 +1619,7 @@ Optional if `ZK_HOST` is defined in `solr.in.sh` or `solr.in.cmd`.+*Example*: `-z 123.321.23.43:2181`-`-solrUrl <url>`::+`-url <url>` or `--solr-url <url>`::+[%autowidth,frame=none]|===@@ -1647,11 +1647,11 @@ NOTE: The `export` command only works with in a Solr running in cloud mode.`bin/solr export [options]`-`bin/solr export -help`+`bin/solr export --help`The `bin/solr export` command takes the following parameters:-`-url <url>`::+`--url <url>`::+[%autowidth,frame=none]|===@@ -1660,9 +1660,9 @@ s|Required |Default: none+Fully-qualified address to a collection.+-*Example*: `-url http://localhost:8983/solr/techproducts`+*Example*: `--url http://localhost:8983/solr/techproducts`-`-format <format>`::+`--format <format>`::+[%autowidth,frame=none]|===@@ -1673,7 +1673,7 @@ The file format of the export, `json`, `jsonl`, or `javabin`.Choosing `javabin` exports in the native Solr format, and is compact and fast to import.`jsonl` is the Json with Lines format, learn more at https://jsonlines.org/.-`-out <path>`::+`--out <path>`::+[%autowidth,frame=none]|===@@ -1684,16 +1684,16 @@ Either the path to the directory for the exported data to be written to, or a sp+If only a directory is specified then the file will be created with the name of the collection, as in `<collection>.json`.-`-compress`::+`--compress`::+[%autowidth,frame=none]|===|Optional |Default: false|===+-If you specify `-compress` then the resulting outputting file with will be gzipped, for example `<collection>.json.gz`.+If you specify `--compress` then the resulting outputting file with will be gzipped, for example `<collection>.json.gz`.-`-query <query string>`::+`--query <query string>`::+[%autowidth,frame=none]|===@@ -1703,7 +1703,7 @@ If you specify `-compress` then the resulting outputting file with will be gzippA custom query.The default is `\*:*` which will export all documents.-`-fields <fields>`::+`--fields <fields>`::+[%autowidth,frame=none]|===@@ -1714,7 +1714,7 @@ Comma separated list of fields to be exported.By default all fields are fetched.-`-limit <number of documents>`::+`--limit <number of documents>`::+[%autowidth,frame=none]|===@@ -1739,13 +1739,13 @@ This parameter is unnecessary if `SOLR_AUTH_TYPE` is defined in `solr.in.sh` orExport all documents from a collection `gettingstarted`:[source,bash]-bin/solr export -url http://localhost:8983/solr/gettingstarted limit -1+bin/solr export --url http://localhost:8983/solr/gettingstarted --limit -1Export all documents of collection `gettingstarted` into a file called `1MDocs.json.gz` as a compressed JSON file:[source,bash]-----bin/solr export -url http://localhost:8983/solr/gettingstarted -1 -format json -compress -out 1MDocs+bin/solr export --url http://localhost:8983/solr/gettingstarted --limit -1 --format json --compress --out 1MDocs----=== Importing Documents into a Collection@@ -1758,7 +1758,7 @@ First export the documents, making sure to ignore any fields that are populated[,console]-----$ bin/solr export -url http://localhost:8983/solr/gettingstarted -fields id,name,manu,cat,features+$ bin/solr export --url http://localhost:8983/solr/gettingstarted --fields id,name,manu,cat,features----Create a new collection to import the exported documents into:@@ -1784,7 +1784,7 @@ $ curl -H 'Content-Type: application/json' -X POST -d @gettingstarted.json 'http[,console]-----$ bin/solr export -url http://localhost:8983/solr/gettingstarted -format javabin -fields id,name,manu,cat,features+$ bin/solr export --url http://localhost:8983/solr/gettingstarted --format javabin --fields id,name,manu,cat,features$ curl -X POST --header "Content-Type: application/javabin" --data-binary @gettingstarted.javabin 'http://localhost:8983/solr/test_collection/update?commit=true'----@@ -1793,13 +1793,13 @@ $ curl -X POST --header "Content-Type: application/javabin" --data-binary @gettiThe `api` command will allow you to send an arbitrary HTTP request to a Solr API endpoint.If you have configured basicAuth or TLS with your Solr you may find this easier than using a separate tool like `curl`.-`bin/solr api -get http://localhost:8983/solr/COLL_NAME/sql?stmt=select+id+from+COLL_NAME+limit+10`+`bin/solr api --solr-url http://localhost:8983/solr/COLL_NAME/sql?stmt=select+id+from+COLL_NAME+limit+10`-`bin/solr api -help`+`bin/solr api --help`The `bin/solr api` command takes the following parameters:-`-get <url>`::+`-url <url>` or `--solr-url <url>`::+[%autowidth,frame=none]|===@@ -1808,7 +1808,7 @@ The `bin/solr api` command takes the following parameters:+Send a GET request to a Solr API endpoint.+-*Example*: `bin/solr api -get http://localhost:8983/solr/COLL_NAME/sql?stmt=select+id+from+COLL_NAME+limit+10`+*Example*: `bin/solr api --solr-url http://localhost:8983/solr/COLL_NAME/sql?stmt=select+id+from+COLL_NAME+limit+10``-u <user:pass>` or `--credentials <username:user:pass>`::+@@ -1825,12 +1825,12 @@ This parameter is unnecessary if `SOLR_AUTH_TYPE` is defined in `solr.in.sh` orSimple search passing in Basic authentication credentials:[source,bash]-$ bin/solr api -get http://localhost:8983/solr/techproducts/select?q=*:* -u user:password+$ bin/solr api --solr-url http://localhost:8983/solr/techproducts/select?q=*:* -u user:passwordHere is an example of sending a SQL query to the techproducts `/sql` end point (assumes you started Solr in Cloud mode with the SQL module enabled):[source,bash]-$ bin/solr api -get http://localhost:8983/solr/techproducts/sql?stmt=select+id+from+techproducts+limit+10+$ bin/solr api --solr-url http://localhost:8983/solr/techproducts/sql?stmt=select+id+from+techproducts+limit+10Results are streamed to the terminal.diff --git a/solr/solr-ref-guide/modules/deployment-guide/pages/solr-in-docker.adoc b/solr/solr-ref-guide/modules/deployment-guide/pages/solr-in-docker.adocindex 2fca485e8b6..248af1b69ed 100644--- a/solr/solr-ref-guide/modules/deployment-guide/pages/solr-in-docker.adoc+++ b/solr/solr-ref-guide/modules/deployment-guide/pages/solr-in-docker.adoc@@ -253,7 +253,7 @@ The same works if you use the xref:docker-compose[example docker compose cluster[source,bash]----docker run -e SOLR_HOST=solr1 --network=mycluster_solr solr solr create -c books -p 8983-docker run --rm -v "$PWD/mydata:/mydata" --network=mycluster_solr solr post -c books /mydata/books.csv -host solr1+docker run --rm -v "$PWD/mydata:/mydata" --network=mycluster_solr solr post -c books /mydata/books.csv --host solr1----Alternatively, you can make the data available on a volume at Solr start time, and then load it from `docker exec` or a custom start script.diff --git a/solr/solr-ref-guide/modules/deployment-guide/pages/zookeeper-file-management.adoc b/solr/solr-ref-guide/modules/deployment-guide/pages/zookeeper-file-management.adocindex bcc54e33a58..eb61066c529 100644--- a/solr/solr-ref-guide/modules/deployment-guide/pages/zookeeper-file-management.adoc+++ b/solr/solr-ref-guide/modules/deployment-guide/pages/zookeeper-file-management.adoc@@ -32,7 +32,7 @@ The below command would start SolrCloud with the default collection name (`getti[source,bash]-----bin/solr start -e cloud -noprompt+bin/solr start -e cloud --no-prompt----You can also explicitly upload a configuration directory when creating a collection using the `bin/solr` script with the `-d` option, such as:diff --git a/solr/solr-ref-guide/modules/deployment-guide/pages/zookeeper-utilities.adoc b/solr/solr-ref-guide/modules/deployment-guide/pages/zookeeper-utilities.adocindex daf66417c5d..2b08e1aea3a 100644--- a/solr/solr-ref-guide/modules/deployment-guide/pages/zookeeper-utilities.adoc+++ b/solr/solr-ref-guide/modules/deployment-guide/pages/zookeeper-utilities.adoc@@ -50,7 +50,7 @@ bin/solr zk upconfig -z 127.0.0.1:9983 -n my_new_config -d server/solr/configset[source,bash]-----./bin/solr zk linkconfig --confname my_new_config -c gettingstarted -z 127.0.0.1:9983+./bin/solr zk linkconfig --conf-name my_new_config -c gettingstarted -z 127.0.0.1:9983----=== Create a New ZooKeeper Pathdiff --git a/solr/solr-ref-guide/modules/getting-started/pages/solr-tutorial.adoc b/solr/solr-ref-guide/modules/getting-started/pages/solr-tutorial.adocindex d3570c8c6a9..771e386a053 100644--- a/solr/solr-ref-guide/modules/getting-started/pages/solr-tutorial.adoc+++ b/solr/solr-ref-guide/modules/getting-started/pages/solr-tutorial.adoc@@ -94,7 +94,7 @@ The following command line will stop Solr and remove the directories for each of[,console]-----$ bin/solr stop -all+$ bin/solr stop --all$ rm -Rf example/cloud/----diff --git a/solr/solr-ref-guide/modules/getting-started/pages/tutorial-films.adoc b/solr/solr-ref-guide/modules/getting-started/pages/tutorial-films.adocindex ba5bbfe534b..2af0776532f 100644--- a/solr/solr-ref-guide/modules/getting-started/pages/tutorial-films.adoc+++ b/solr/solr-ref-guide/modules/getting-started/pages/tutorial-films.adoc@@ -93,7 +93,7 @@ WARNING: Using _default configset. Data driven schema functionality is enabled bNOT RECOMMENDED for production use.To turn it off:- bin/solr config -c films -p 7574 -action set-user-property -property update.autoCreateFields -value false+ bin/solr config -c films -p 7574 --action set-user-property --property update.autoCreateFields --value falseConnecting to ZooKeeper at localhost:9983 ...INFO - 2017-07-27 15:07:46.191; org.apache.solr.client.solrj.impl.ZkClientClusterStateProvider; Cluster at localhost:9983 readydiff --git a/solr/solr-ref-guide/modules/getting-started/pages/tutorial-five-minutes.adoc b/solr/solr-ref-guide/modules/getting-started/pages/tutorial-five-minutes.adocindex e5311ff44da..c072abeda36 100644--- a/solr/solr-ref-guide/modules/getting-started/pages/tutorial-five-minutes.adoc+++ b/solr/solr-ref-guide/modules/getting-started/pages/tutorial-five-minutes.adoc@@ -77,7 +77,7 @@ A single document can be indexed as:[,console]----$ curl --request POST \---url 'http://localhost:8983/api/collections/techproducts/update' \+ --url 'http://localhost:8983/api/collections/techproducts/update' \--header 'Content-Type: application/json' \--data ' {"id" : "978-0641723445",diff --git a/solr/solr-ref-guide/modules/getting-started/pages/tutorial-solrcloud.adoc b/solr/solr-ref-guide/modules/getting-started/pages/tutorial-solrcloud.adocindex 54c7d531edc..03de6b396c3 100644--- a/solr/solr-ref-guide/modules/getting-started/pages/tutorial-solrcloud.adoc+++ b/solr/solr-ref-guide/modules/getting-started/pages/tutorial-solrcloud.adoc@@ -81,7 +81,7 @@ The script will start each node in order and show you the command it uses to sta[,console]-----$ bin/solr start -cloud -s example/cloud/node1/solr -p 8983+$ bin/solr start --cloud -s example/cloud/node1/solr -p 8983----The first node will also start an embedded ZooKeeper server bound to port 9983.@@ -156,16 +156,16 @@ To stop Solr in SolrCloud mode, you would use the `bin/solr` script and issue th[,console]-----$ bin/solr stop -all+$ bin/solr stop --all-----=== Starting with -noprompt+=== Starting with --no-promptYou can also get SolrCloud started with all the defaults instead of the interactive session using the following command:[,console]-----$ bin/solr start -e cloud -noprompt+$ bin/solr start -e cloud --no-prompt----=== Restarting Nodes@@ -195,7 +195,7 @@ Once you start a SolrCloud cluster using the startup scripts, you can add a new[,console]----$ mkdir <solr.home for new Solr node>-$ bin/solr start -cloud -s <solr.home>/solr -p <port num> -z <zk hosts string>+$ bin/solr start --cloud -s <solr.home>/solr -p <port num> -z <zk hosts string>----Notice that the above requires you to create a Solr home directory.@@ -205,7 +205,7 @@ Example (with directory structure) that adds a node to an example started with "[,console]----$ mkdir -p example/cloud/node3/solr-$ bin/solr start -cloud -s example/cloud/node3/solr -p 8987 -z localhost:9983+$ bin/solr start --cloud -s example/cloud/node3/solr -p 8987 -z localhost:9983----The previous command will start another Solr node on port 8987 with Solr home set to `example/cloud/node3/solr`.diff --git a/solr/solr-ref-guide/modules/getting-started/pages/tutorial-techproducts.adoc b/solr/solr-ref-guide/modules/getting-started/pages/tutorial-techproducts.adocindex 1f73e8e52f8..e00e5b19991 100644--- a/solr/solr-ref-guide/modules/getting-started/pages/tutorial-techproducts.adoc+++ b/solr/solr-ref-guide/modules/getting-started/pages/tutorial-techproducts.adoc@@ -24,7 +24,7 @@ Then you will index some sample data that ships with Solr and do some basic searTo launch Solr, run: `bin/solr start -e cloud` on Unix or MacOS; `bin\solr.cmd start -e cloud` on Windows.This will start an interactive session that will start two Solr "servers" on your machine.-This command has an option to run without prompting you for input (`-noprompt`), but we want to modify two of the defaults so we won't use that option now.+This command has an option to run without prompting you for input (`--no-prompt`), but we want to modify two of the defaults so we won't use that option now.[,console]----@@ -71,14 +71,14 @@ Cloning /solr-{solr-full-version}/example/cloud/node1 into/solr-{solr-full-version}/example/cloud/node2Starting up Solr on port 8983 using command:-"bin/solr" start -cloud -p 8983 -s "example/cloud/node1/solr"+"bin/solr" start --cloud -p 8983 -s "example/cloud/node1/solr"Waiting up to 180 seconds to see Solr running on port 8983 [\]Started Solr server on port 8983 (pid=34942). Happy searching!Starting up Solr on port 7574 using command:-"bin/solr" start -cloud -p 7574 -s "example/cloud/node2/solr" -z localhost:9983+"bin/solr" start --cloud -p 7574 -s "example/cloud/node2/solr" -z localhost:9983Waiting up to 180 seconds to see Solr running on port 7574 [\]Started Solr server on port 7574 (pid=35036). Happy searching!@@ -502,7 +502,7 @@ To stop both of the Solr nodes we started, issue the command:[,console]-----$ bin/solr stop -all+$ bin/solr stop --all----For more information on start/stop and collection options with `bin/solr`, see xref:deployment-guide:solr-control-script-reference.adoc[].diff --git a/solr/solr-ref-guide/modules/indexing-guide/pages/post-tool.adoc b/solr/solr-ref-guide/modules/indexing-guide/pages/post-tool.adocindex 57ad8d83575..5e250e065f1 100644--- a/solr/solr-ref-guide/modules/indexing-guide/pages/post-tool.adoc+++ b/solr/solr-ref-guide/modules/indexing-guide/pages/post-tool.adoc@@ -28,7 +28,7 @@ $ bin/solr post -url http://localhost:8983/gettingstarted/update example/films/f----This will contact the server at `localhost:8983`.-The `-help` (or simply `-h`) option will output information on its usage (i.e., `bin/solr post -help)`.+The `--help` (or simply `-h`) option will output information on its usage (i.e., `bin/solr post -h)`.== Using the bin/solr post Tool@@ -42,42 +42,63 @@ The basic usage of `bin/solr post` is:[source,plain]----usage: post- -c,--name <NAME> Name of the collection.- -delay <delay> If recursive then delay will- be the wait time between- posts. default: 10 for web,- 0 for files- -filetypes <<type>[,<type>,...]> default:- xml,json,jsonl,csv,pdf,doc,d- ocx,ppt,pptx,xls,xlsx,odt,od- p,ods,ott,otp,ots,rtf,htm,ht- ml,txt,log- -format sends application/json- content as Solr commands to- /update instead of- /update/json/docs- -help Print this message- -mode <mode> Files crawls files, web- crawls website. default:- files.- -skipcommit Skip committing newly- posted documents- -optimize Issue an optimize at the end of- posting documents- -out sends Solr response outputs- to console- -params <<key>=<value>[&<key>=<value>...]> values must be URL-encoded;- these pass through to Solr- update request- -recursive <recursive> For web crawl, how deep to- go. default: 1- -type <content-type> default: application/json- -u,--credentials <credentials> Credentials in the format- username:password. Example:- --credentials solr:SolrRocks- -url <url> <base Solr update URL>- -verbose Enable more verbose command- output.+ -c,--name <NAME> Name of the collection.+ -d,--delay <delay> If recursive then delay+ will be the wait time+ between posts. default:+ 10 for web, 0 for files+ --dry-run Performs a dry run of+ the posting process+ without actually sending+ documents to Solr. Only+ works with files mode.+ -f,--format sends application/json+ content as Solr commands+ to /update instead of+ /update/json/docs.+ -ft,--filetypes <<type>[,<type>,...]> default:+ xml,json,jsonl,csv,pdf,d+ oc,docx,ppt,pptx,xls,xls+ x,odt,odp,ods,ott,otp,ot+ s,rtf,htm,html,txt,log+ -h,--help Print this message.+ --mode <mode> Which mode the Post tool+ is running in, 'files'+ crawls local directory,+ 'web' crawls website,+ 'args' processes input+ args, and 'stdin' reads+ a command from standard+ in. default: files.+ -o,--optimize Issue an optimize at end+ of posting documents.+ --out sends Solr response+ outputs to console.+ -p,--params <<key>=<value>[&<key>=<value>...]> values must be+ URL-encoded; these pass+ through to Solr update+ request.+ -r,--recursive <recursive> For web crawl, how deep+ to go. default: 1+ --skip-commit Do not 'commit', and+ thus changes won't be+ visible till a commit+ occurs.+ -t,--type <content-type> Specify a specific+ mimetype to use, such as+ application/json.+ -u,--credentials <credentials> Credentials in the+ format+ username:password.+ Example: --credentials+ solr:SolrRocks+ -url,--solr-update-url <UPDATEURL> Solr Update URL, the+ full url to the update+ handler, including the+ /update.+ -v,--verbose Enable more verbose+ command output.+----== Examples Using bin/solr postdiff --git a/solr/solr-ref-guide/modules/indexing-guide/pages/schemaless-mode.adoc b/solr/solr-ref-guide/modules/indexing-guide/pages/schemaless-mode.adocindex 777de464151..a79dc8ca082 100644--- a/solr/solr-ref-guide/modules/indexing-guide/pages/schemaless-mode.adoc+++ b/solr/solr-ref-guide/modules/indexing-guide/pages/schemaless-mode.adoc@@ -222,7 +222,7 @@ Automatic field creation can be disabled with the `update.autoCreateFields` propTo do this, you can use xref:deployment-guide:solr-control-script-reference.adoc#set-or-unset-configuration-properties[`bin/solr config`] with a command such as:[source,bash]-bin/solr config -c mycollection -p 8983 -action set-user-property -property update.autoCreateFields -value false+bin/solr config -c mycollection -p 8983 --action set-user-property --property update.autoCreateFields --value false== Examples of Indexed Documentsdiff --git a/solr/solr-ref-guide/modules/query-guide/pages/logs.adoc b/solr/solr-ref-guide/modules/query-guide/pages/logs.adocindex 33adbdc3cf3..0032994d211 100644--- a/solr/solr-ref-guide/modules/query-guide/pages/logs.adoc+++ b/solr/solr-ref-guide/modules/query-guide/pages/logs.adoc@@ -32,7 +32,7 @@ The `postlogs` command reads in Solr's log format and indexes it in a Solr colle`bin/solr postlogs [options]`-`bin/solr postlogs -help`+`bin/solr postlogs --help`==== Healthcheck Parametersdiff --git a/solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-10.adoc b/solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-10.adocindex e1491a6d74f..532c13fabe0 100644--- a/solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-10.adoc+++ b/solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-10.adoc@@ -26,6 +26,11 @@ Before starting an upgrade to this version of Solr, please take the time to revi// TODO add similar text that previous releases have at this spot.+=== Solr CLI and Scripts++The Solr CLI has gone through some significant renovations to reduce technical debt, and now functions more consistently and predictably. Most notably, CLI commands now use unix-style options, e.g. `--help` instead of `-help`.+Users are urged to review all use of the `bin/solr` command, such as in scripts and documentation, to ensure that the correct options are being used.+=== SolrJ* Starting in 10, the Maven POM for SolrJ does not refer to SolrJ modules like ZooKeeper. If you require such functionality, you need to add additional dependencies.diff --git a/solr/solr-ref-guide/modules/upgrade-notes/pages/solr-upgrade-notes.adoc b/solr/solr-ref-guide/modules/upgrade-notes/pages/solr-upgrade-notes.adocindex e7b74148e87..890a2a98ffa 100644--- a/solr/solr-ref-guide/modules/upgrade-notes/pages/solr-upgrade-notes.adoc+++ b/solr/solr-ref-guide/modules/upgrade-notes/pages/solr-upgrade-notes.adoc@@ -73,4 +73,3 @@ The upgrade from 7.x to 8.0 introduced several *major* changes that you should bPlease do a thorough review of the section xref:major-changes-in-solr-8.adoc[] before starting your upgrade.A summary of the significant changes between Solr 6.x and Solr 7.0 is in the section xref:major-changes-in-solr-7.adoc[].-diff --git a/solr/solrj/src/test-files/solrj/solr/multicore/zoo.cfg b/solr/solrj/src/test-files/solrj/solr/multicore/zoo.cfgindex cbd6970e3fc..f234b7568a9 100644--- a/solr/solrj/src/test-files/solrj/solr/multicore/zoo.cfg+++ b/solr/solrj/src/test-files/solrj/solr/multicore/zoo.cfg@@ -16,4 +16,4 @@ syncLimit=5# NOTE: Solr sets this based on zkRun / zkHost params# Disable ZK AdminServer since we do not use it-admin.enableServer=false\ No newline at end of file+admin.enableServer=falsediff --git a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.javaindex 435a2a931ba..5e0db3135c4 100644--- a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java+++ b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java@@ -407,15 +407,16 @@ public abstract class AbstractDistribZkTestBase extends BaseDistributedSearchTes//// copyConfigUp(TEST_PATH().resolve("configsets"), "cloud-minimal", "configset-name", zk_address);- protected static void copyConfigUp(+ public static void copyConfigUp(Path configSetDir, String srcConfigSet, String dstConfigName, String zkAddr)throws Exception {++ File fullConfDir = new File(configSetDir.toFile(), srcConfigSet);String[] args =new String[] {- "-confname", dstConfigName,- "-confdir", srcConfigSet,- "-zkHost", zkAddr,- "-configsetsDir", configSetDir.toString(),+ "--conf-name", dstConfigName,+ "--conf-dir", fullConfDir.getAbsolutePath(),+ "-z", zkAddr};ConfigSetUploadTool tool = new ConfigSetUploadTool();diff --git a/solr/webapp/web/partials/security.html b/solr/webapp/web/partials/security.htmlindex 98305554d9e..47d17a0d542 100644--- a/solr/webapp/web/partials/security.html+++ b/solr/webapp/web/partials/security.html@@ -31,7 +31,7 @@ limitations under the License.<pre>- bin/solr auth enable -type basicAuth -prompt true -z {{zkHost}}+ bin/solr auth enable --type basicAuth --prompt true -z {{zkHost}}</pre></div>