This is an automated email from the ASF dual-hosted git repository.
epugh pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/branch_9x by this push:
new 6e161994d7c SOLR-16824: Backport single dash arguments migration
(#2618)
6e161994d7c is described below
commit 6e161994d7c8756f973e70f2946cef3f3f6ee5f3
Author: Christos Malliaridis <[email protected]>
AuthorDate: Sat Aug 10 16:11:45 2024 +0300
SOLR-16824: Backport single dash arguments migration (#2618)
* Broad array of improvements to nudge users from single dash to mulitple
dash usage.
* Fixes many places in the code where both single dash and double dash
needed to work for backwards compatiblity.
* Many of these fixes apply ONLY to the code on the 9x line that are
deprecated and removed from main.
---
solr/bin/install_solr_service.sh | 2 +-
solr/bin/post | 16 +-
solr/bin/solr | 44 +--
solr/bin/solr.cmd | 59 +++-
.../src/java/org/apache/solr/cli/AuthTool.java | 2 +-
.../src/java/org/apache/solr/cli/PackageTool.java | 2 +-
.../core/src/java/org/apache/solr/cli/SolrCLI.java | 4 +-
.../core/src/java/org/apache/solr/cloud/ZkCLI.java | 362 ++++++++++++++++-----
.../org/apache/solr/cli/TestSolrCLIRunExample.java | 2 +-
.../src/test/org/apache/solr/cloud/ZkCLITest.java | 3 +-
solr/docker/scripts/wait-for-solr.sh | 2 +-
solr/docker/scripts/wait-for-zookeeper.sh | 2 +-
solr/server/scripts/cloud-scripts/snapshotscli.sh | 2 +-
.../monitoring-with-prometheus-and-grafana.adoc | 2 +-
.../pages/solr-control-script-reference.adoc | 28 +-
.../modules/indexing-guide/pages/post-tool.adoc | 2 +-
16 files changed, 384 insertions(+), 150 deletions(-)
diff --git a/solr/bin/install_solr_service.sh b/solr/bin/install_solr_service.sh
index d3135d489ff..479adf8263a 100755
--- a/solr/bin/install_solr_service.sh
+++ b/solr/bin/install_solr_service.sh
@@ -162,7 +162,7 @@ if [ $# -gt 1 ]; then
SOLR_START=false
shift 1
;;
- -help|-usage)
+ -help|--help|-h|-usage)
print_usage ""
exit 0
;;
diff --git a/solr/bin/post b/solr/bin/post
index e7ef443afd2..67c2dbef4fd 100755
--- a/solr/bin/post
+++ b/solr/bin/post
@@ -58,7 +58,7 @@
TOOL_JAR=("$SOLR_TIP/server/solr-webapp/webapp/WEB-INF/lib"/solr-core-*.jar)
function print_usage() {
echo ""
echo 'Usage: post -c <collection> [OPTIONS] <files|directories|urls|-d
["...",...]>'
- echo " or post -help"
+ echo " or post --help"
echo ""
echo " collection name defaults to DEFAULT_SOLR_COLLECTION if not
specified"
echo ""
@@ -67,7 +67,7 @@ function print_usage() {
echo " Solr options:"
echo " -url <base Solr update URL> (overrides collection, host, and port)"
echo " -host <host> (default: localhost)"
- echo " -p or -port <port> (default: 8983)"
+ echo " -p or --port <port> (default: 8983)"
echo " -commit yes|no (default: yes)"
echo " -u or -user <user:pass> (sets BasicAuth credentials)"
# optimize intentionally omitted, but can be used as '-optimize yes'
(default: no)
@@ -85,7 +85,7 @@ function print_usage() {
echo " Other options:"
echo " -filetypes <type>[,<type>,...] (default:
xml,json,jsonl,csv,pdf,doc,docx,ppt,pptx,xls,xlsx,odt,odp,ods,ott,otp,ots,rtf,htm,html,txt,log)"
echo " -params \"<key>=<value>[&<key>=<value>...]\" (values must be
URL-encoded; these pass through to Solr update request)"
- echo " -out yes|no (default: no; yes outputs Solr response to console)"
+ echo " --out yes|no (default: no; yes outputs Solr response to console)"
echo " -format solr (sends application/json content as Solr commands to
/update instead of /update/json/docs)"
echo ""
echo ""
@@ -96,12 +96,12 @@ function print_usage() {
echo "* CSV file: $THIS_SCRIPT -c signals LATEST-signals.csv"
echo "* Directory of files: $THIS_SCRIPT -c myfiles ~/Documents"
echo "* Web crawl: $THIS_SCRIPT -c gettingstarted https://solr.apache.org/
-recursive 1 -delay 1"
- echo "* Standard input (stdin): echo '{"commit": {}}' | $THIS_SCRIPT -c
my_collection -type application/json -out yes -d"
+ echo "* Standard input (stdin): echo '{"commit": {}}' | $THIS_SCRIPT -c
my_collection -type application/json --out yes -d"
echo "* Data as string: $THIS_SCRIPT -c signals -type text/csv -out yes -d
$'id,value\n1,0.47'"
echo ""
} # end print_usage
-if [[ $# -eq 1 && ("$1" == "-help" || "$1" == "-h" || "$1" == "-usage") ]];
then
+if [[ $# -eq 1 && ("$1" == "-help" || "$1" == "--help" || "$1" == "-h" || "$1"
== "-usage") ]]; then
print_usage
exit
fi
@@ -138,7 +138,7 @@ while [ $# -gt 0 ]; do
shift
COLLECTION="$1"
elif [[ "$1" == "-p" ]]; then
- # -p alias for -port for convenience and compatibility with `bin/solr
start`
+ # -p alias for --port for convenience and compatibility with `bin/solr
start`
shift
PROPS+=("-Dport=$1")
elif [[ ("$1" == "-d" || "$1" == "--data" || "$1" == "-") ]]; then
@@ -236,5 +236,5 @@ echo "$JAVA" -classpath "${TOOL_JAR[0]}" "${PROPS[@]}"
org.apache.solr.cli.Simpl
"$JAVA" -classpath "${TOOL_JAR[0]}" "${PROPS[@]}"
org.apache.solr.cli.SimplePostTool "${PARAMS[@]}"
# post smoker:
-# bin/post -c signals -out yes -type application/json -d '[{"id": 2, "val":
0.47}]'
-# bin/post -c signals -out yes -params "wt=json" -d '<add><doc><field
name="id">1</field></doc></add>'
+# bin/post -c signals --out yes -type application/json -d '[{"id": 2, "val":
0.47}]'
+# bin/post -c signals --out yes -params "wt=json" -d '<add><doc><field
name="id">1</field></doc></add>'
diff --git a/solr/bin/solr b/solr/bin/solr
index acb627b5886..36585f745e5 100755
--- a/solr/bin/solr
+++ b/solr/bin/solr
@@ -380,8 +380,8 @@ function print_usage() {
echo ""
echo " Omit '-z localhost:2181' from the above command if you have
defined ZK_HOST in solr.in.sh."
echo ""
- echo "Pass -help or -h after any COMMAND to see command-specific usage
information,"
- echo " such as: ./solr start -help or ./solr stop -h"
+ echo "Pass --help or -h after any COMMAND to see command-specific usage
information,"
+ echo " such as: ./solr start --help or ./solr stop -h"
echo ""
elif [[ "$CMD" == "start" || "$CMD" == "restart" ]]; then
echo ""
@@ -469,10 +469,10 @@ function print_usage() {
echo ""
echo " -c <collection> Collection to run healthcheck against."
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 " otherwise, default is localhost:9983"
echo ""
- echo " -V/-verbose Enable more verbose output for this
script."
+ echo " -V/--verbose Enable more verbose output for this
script."
echo ""
elif [ "$CMD" == "status" ]; then
echo ""
@@ -520,14 +520,14 @@ function print_usage() {
echo " Alternatively, you can pass the path to your own configuration
directory instead of using"
echo " one of the built-in configurations, such as: bin/solr
create_core -c mycore -d /tmp/myconfig"
echo ""
- echo " -p or -port <port> Port of a local Solr instance where you want
to create the new core"
+ echo " -p or --port <port> Port of a local Solr instance where you want
to create the new core"
echo " If not specified, the script will search the
local system for a running"
echo " Solr instance and will use the port of the
first server it finds."
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/-verbose Enable more verbose output for this script"
+ echo " -V/--verbose Enable more verbose output for this script"
echo ""
elif [ "$CMD" == "create_collection" ]; then
echo ""
@@ -560,14 +560,14 @@ function print_usage() {
echo ""
echo " -replicationFactor or -rf <#> Number of copies of each document
in the collection, default is 1 (no replication)"
echo ""
- echo " -p or -port <port> Port of a local Solr instance
where you want to create the new collection"
+ echo " -p or --port <port> Port of a local Solr instance
where you want to create the new collection"
echo " If not specified, the script
will search the local system for a running"
echo " Solr instance and will use the
port of the first server it finds."
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/-verbose Enable more verbose output for
this script."
+ echo " -V/--verbose Enable more verbose output for
this script."
echo ""
elif [ "$CMD" == "zk" ]; then
print_short_zk_usage ""
@@ -858,7 +858,7 @@ if [ $# -eq 1 ]; then
fi
if [ $# -gt 0 ]; then
- # if first arg starts with a dash (and it's not -help or -info),
+ # if first arg starts with a dash (and it's not --help or -info),
# then assume they are starting Solr, such as: solr -f
if [[ $1 == -* ]]; then
SCRIPT_CMD="start"
@@ -896,7 +896,7 @@ if [ "$SCRIPT_CMD" == "healthcheck" ]; then
if [ $# -gt 0 ]; then
while true; do
case "$1" in
- -c|-collection)
+ -c|--collection|-collection)
if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
print_usage "$SCRIPT_CMD" "Collection name is required when
using the $1 option!"
exit 1
@@ -904,7 +904,7 @@ if [ "$SCRIPT_CMD" == "healthcheck" ]; then
HEALTHCHECK_COLLECTION="$2"
shift 2
;;
- -z|-zkhost|-zkHost)
+ -z|--zk-host|-zkhost|-zkHost|--zkHost)
if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
print_usage "$SCRIPT_CMD" "ZooKeeper connection string is
required when using the $1 option!"
exit 1
@@ -916,8 +916,8 @@ if [ "$SCRIPT_CMD" == "healthcheck" ]; then
print_usage "$SCRIPT_CMD"
exit 0
;;
- -V|-verbose)
- VERBOSE="-verbose"
+ -V|--verbose|-verbose)
+ VERBOSE="--verbose"
shift
;;
--)
@@ -946,7 +946,7 @@ if [ "$SCRIPT_CMD" == "healthcheck" ]; then
exit 1
fi
- run_tool healthcheck -zkHost "$ZK_HOST" -collection
"$HEALTHCHECK_COLLECTION" $VERBOSE
+ run_tool healthcheck --zk-host "$ZK_HOST" --collection
"$HEALTHCHECK_COLLECTION" $VERBOSE
exit $?
fi
@@ -957,7 +957,7 @@ if [[ "$SCRIPT_CMD" == "config" ]]; then
if [ $# -gt 0 ]; then
while true; do
case "$1" in
- -z|-zkhost|-zkHost)
+ -z|--zk-host|-zkhost|-zkHost|--zkHost)
if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
print_usage "$SCRIPT_CMD" "ZooKeeper connection string is
required when using the $1 option!"
exit 1
@@ -965,7 +965,7 @@ if [[ "$SCRIPT_CMD" == "config" ]]; then
ZK_HOST="$2"
shift 2
;;
- -s|-scheme)
+ -s|--scheme|-scheme)
if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
print_usage "$SCRIPT_CMD" "URL scheme is required when using
the $1 option!"
exit 1
@@ -988,7 +988,7 @@ if [[ "$SCRIPT_CMD" == "config" ]]; then
CONFIG_PARAMS+=("-z" "$ZK_HOST")
fi
if [[ -n "$SOLR_URL_SCHEME" ]]; then
- CONFIG_PARAMS+=("-scheme" "$SOLR_URL_SCHEME")
+ CONFIG_PARAMS+=("--scheme" "$SOLR_URL_SCHEME")
fi
run_tool config "${CONFIG_PARAMS[@]}"
exit $?
@@ -1129,7 +1129,7 @@ if [[ "$SCRIPT_CMD" == "zk" ]]; then
ZK_RECURSE="true"
shift
;;
- -c|-collection)
+ -c|--collection|-collection)
ZK_COLLECTION="$2"
shift
;;
diff --git a/solr/bin/solr.cmd b/solr/bin/solr.cmd
index 4c916c78eb5..264dd1c42c9 100755
--- a/solr/bin/solr.cmd
+++ b/solr/bin/solr.cmd
@@ -251,12 +251,12 @@ IF "%1"=="-help" goto run_solrcli
IF "%1"=="-usage" goto run_solrcli
IF "%1"=="-h" goto run_solrcli
IF "%1"=="--help" goto run_solrcli
-IF "%1"=="-help" goto run_solrcli
IF "%1"=="/?" goto run_solrcli
IF "%1"=="status" goto get_status
IF "%1"=="version" goto run_solrcli
IF "%1"=="-v" goto run_solrcli
IF "%1"=="-version" goto run_solrcli
+IF "%1"=="--version" goto run_solrcli
IF "%1"=="assert" goto run_solrcli
IF "%1"=="export" goto run_solrcli
IF "%1"=="package" goto run_solrcli
@@ -354,8 +354,8 @@ goto done
@echo.
@echo Omit '-z localhost:2181' from the above command if you have defined
ZK_HOST in solr.in.cmd.
@echo.
-@echo Pass -help after any COMMAND to see command-specific usage information,
-@echo such as: solr start -help or solr stop -help
+@echo Pass --help after any COMMAND to see command-specific usage information,
+@echo such as: solr start --help or solr stop --help
@echo.
goto done
@@ -461,11 +461,11 @@ echo Create a core or collection depending on whether
Solr is running in stand
echo mode (collection). In other words, this action detects which mode Solr
is running in, and then takes
echo the appropriate action (either create_core or create_collection). For
detailed usage instructions, do:
echo.
-echo bin\solr create_core -help
+echo bin\solr create_core --help
echo.
echo or
echo.
-echo bin\solr create_collection -help
+echo bin\solr create_collection --help
echo.
goto done
@@ -674,11 +674,14 @@ IF "%SCRIPT_CMD%"=="" set SCRIPT_CMD=start
IF [%1]==[] goto process_script_cmd
IF "%1"=="-help" goto usage
IF "%1"=="-usage" goto usage
+IF "%1"=="--help" goto usage
+IF "%1"=="-h" goto usage
IF "%1"=="/?" goto usage
IF "%1"=="-f" goto set_foreground_mode
IF "%1"=="--foreground" goto set_foreground_mode
IF "%1"=="-V" goto set_verbose
IF "%1"=="--verbose" goto set_verbose
+IF "%1"=="-verbose" goto set_verbose
IF "%1"=="-v" goto set_debug
IF "%1"=="-q" goto set_warn
IF "%1"=="-c" goto set_cloud_mode
@@ -691,11 +694,13 @@ IF "%1"=="-t" goto set_solr_data_dir
IF "%1"=="--solr-data" goto set_solr_data_dir
IF "%1"=="-e" goto set_example
IF "%1"=="--example" goto set_example
+IF "%1"=="-example" goto set_example
IF "%1"=="--host" goto set_host
IF "%1"=="-m" goto set_memory
IF "%1"=="--memory" goto set_memory
IF "%1"=="-p" goto set_port
IF "%1"=="--port" goto set_port
+IF "%1"=="-port" goto set_port
IF "%1"=="-z" goto set_zookeeper
IF "%1"=="--zk-host" goto set_zookeeper
IF "%1"=="-zkHost" goto set_zookeeper
@@ -707,9 +712,11 @@ IF "%1"=="-a" goto set_addl_opts
IF "%1"=="--additional-options" goto set_addl_opts
IF "%1"=="-j" goto set_addl_jetty_config
IF "%1"=="--jettyconfig" goto set_addl_jetty_config
+IF "%1"=="-noprompt" goto set_noprompt
IF "%1"=="--noprompt" goto set_noprompt
IF "%1"=="--no-prompt" goto set_noprompt
IF "%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_all
IF "%1"=="-all" goto set_stop_all
@@ -1515,16 +1522,21 @@ IF [%1]==[] goto run_healthcheck
IF "%1"=="-V" goto set_healthcheck_verbose
IF "%1"=="-c" goto set_healthcheck_collection
IF "%1"=="-collection" goto set_healthcheck_collection
+IF "%1"=="--collection" goto set_healthcheck_collection
IF "%1"=="-z" goto set_healthcheck_zk
+IF "%1"=="--zk-host" goto set_healthcheck_zk
IF "%1"=="-zkhost" goto set_healthcheck_zk
IF "%1"=="-zkHost" goto set_healthcheck_zk
+IF "%1"=="--zkHost" goto set_healthcheck_zk
+IF "%1"=="-h" goto usage
+IF "%1"=="--help" goto usage
IF "%1"=="-help" goto usage
IF "%1"=="-usage" goto usage
IF "%1"=="/?" goto usage
goto run_healthcheck
:set_healthcheck_verbose
-set HEALTHCHECK_VERBOSE="-verbose"
+set HEALTHCHECK_VERBOSE="--verbose"
SHIFT
goto parse_healthcheck_args
@@ -1548,7 +1560,7 @@ echo ZK_HOST: !ZK_HOST!
"%JAVA%" %SOLR_SSL_OPTS% %AUTHC_OPTS% %SOLR_ZK_CREDS_AND_ACLS%
-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 healthcheck -collection !HEALTHCHECK_COLLECTION!
-zkHost !ZK_HOST! %HEALTHCHECK_VERBOSE%
+ org.apache.solr.cli.SolrCLI healthcheck --collection
!HEALTHCHECK_COLLECTION! --zk-host !ZK_HOST! %HEALTHCHECK_VERBOSE%
goto done
:run_solrcli
@@ -1568,6 +1580,7 @@ IF "%1"=="--zk-host" goto set_config_zk
IF "%1"=="-zkHost" goto set_config_zk
IF "%1"=="--zkHost" goto set_config_zk
IF "%1"=="-s" goto set_config_url_scheme
+IF "%1"=="--scheme" goto set_config_url_scheme
IF "%1"=="-scheme" goto set_config_url_scheme
set "CONFIG_ARGS=!CONFIG_ARGS! %1"
SHIFT
@@ -1587,7 +1600,7 @@ goto parse_config_args
:run_config
IF NOT "!ZK_HOST!"=="" SET "CONFIG_ARGS=!CONFIG_ARGS! -z !ZK_HOST!"
-IF NOT "!SOLR_URL_SCHEME!"=="" SET "CONFIG_ARGS=!CONFIG_ARGS! -scheme
!SOLR_URL_SCHEME!"
+IF NOT "!SOLR_URL_SCHEME!"=="" SET "CONFIG_ARGS=!CONFIG_ARGS! --scheme
!SOLR_URL_SCHEME!"
"%JAVA%" %SOLR_SSL_OPTS% %AUTHC_OPTS% %SOLR_ZK_CREDS_AND_ACLS%
-Dsolr.install.dir="%SOLR_TIP%" ^
-Dlog4j.configurationFile="file:///%DEFAULT_SERVER_DIR%\resources\log4j2-console.xml"
^
@@ -1611,16 +1624,22 @@ IF "%1"=="-V" goto set_create_verbose
IF "%1"=="-c" goto set_create_name
IF "%1"=="-core" goto set_create_name
IF "%1"=="-collection" goto set_create_name
+IF "%1"=="--collection" goto set_create_name
IF "%1"=="-d" goto set_create_confdir
+IF "%1"=="--conf-dir" goto set_create_confdir
IF "%1"=="-confdir" goto set_create_confdir
IF "%1"=="-n" goto set_create_confname
+IF "%1"=="--conf-name" goto set_create_confname
IF "%1"=="-confname" goto set_create_confname
IF "%1"=="-s" goto set_create_shards
IF "%1"=="-shards" goto set_create_shards
IF "%1"=="-rf" goto set_create_rf
IF "%1"=="-replicationFactor" goto set_create_rf
IF "%1"=="-p" goto set_create_port
+IF "%1"=="--port" goto set_create_port
IF "%1"=="-port" goto set_create_port
+IF "%1"=="-h" goto usage
+IF "%1"=="--help" goto usage
IF "%1"=="-help" goto usage
IF "%1"=="-usage" goto usage
IF "%1"=="/?" goto usage
@@ -1628,7 +1647,7 @@ goto run_create
:set_create_verbose
-set CREATE_VERBOSE="-verbose"
+set CREATE_VERBOSE="--verbose"
SHIFT
goto parse_create_args
@@ -1698,22 +1717,22 @@ if "!CREATE_PORT!"=="" (
if "!CREATE_CONFDIR!"=="_default" (
echo WARNING: Using _default configset with data driven schema
functionality. NOT RECOMMENDED for production use.
- echo To turn off: bin\solr config -c !CREATE_NAME! -p !CREATE_PORT!
-action set-user-property -property update.autoCreateFields -value false
+ echo To turn off: bin\solr config -c !CREATE_NAME! -p !CREATE_PORT!
--action set-user-property --property update.autoCreateFields --value false
)
if "%SCRIPT_CMD%"=="create_core" (
"%JAVA%" %SOLR_SSL_OPTS% %AUTHC_OPTS% %SOLR_ZK_CREDS_AND_ACLS%
-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 create_core -name !CREATE_NAME! -solrUrl
!SOLR_URL_SCHEME!://%SOLR_TOOL_HOST%:!CREATE_PORT!/solr ^
- -confdir !CREATE_CONFDIR! -configsetsDir
"%SOLR_TIP%\server\solr\configsets" %CREATE_VERBOSE%
+ org.apache.solr.cli.SolrCLI create_core -name !CREATE_NAME! --solr-url
!SOLR_URL_SCHEME!://%SOLR_TOOL_HOST%:!CREATE_PORT!/solr ^
+ --conf-dir !CREATE_CONFDIR! -configsetsDir
"%SOLR_TIP%\server\solr\configsets" %CREATE_VERBOSE%
) else (
"%JAVA%" %SOLR_SSL_OPTS% %AUTHC_OPTS% %SOLR_ZK_CREDS_AND_ACLS%
-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 create -name !CREATE_NAME! -shards
!CREATE_NUM_SHARDS! -replicationFactor !CREATE_REPFACT! ^
- -confname !CREATE_CONFNAME! -confdir !CREATE_CONFDIR! -configsetsDir
"%SOLR_TIP%\server\solr\configsets" ^
- -solrUrl !SOLR_URL_SCHEME!://%SOLR_TOOL_HOST%:!CREATE_PORT!/solr
%CREATE_VERBOSE%
+ --conf-name !CREATE_CONFNAME! --conf-dir !CREATE_CONFDIR! -configsetsDir
"%SOLR_TIP%\server\solr\configsets" ^
+ --solr-url !SOLR_URL_SCHEME!://%SOLR_TOOL_HOST%:!CREATE_PORT!/solr
%CREATE_VERBOSE%
)
goto done
@@ -1724,16 +1743,20 @@ IF "%1"=="-V" goto set_delete_verbose
IF "%1"=="-c" goto set_delete_name
IF "%1"=="-core" goto set_delete_name
IF "%1"=="-collection" goto set_delete_name
+IF "%1"=="--collection" goto set_delete_name
IF "%1"=="-p" goto set_delete_port
+IF "%1"=="--port" goto set_delete_port
IF "%1"=="-port" goto set_delete_port
IF "%1"=="-deleteConfig" goto set_delete_config
+IF "%1"=="-h" goto usage
+IF "%1"=="--help" goto usage
IF "%1"=="-help" goto usage
IF "%1"=="-usage" goto usage
IF "%1"=="/?" goto usage
goto run_delete
:set_delete_verbose
-set DELETE_VERBOSE="-verbose"
+set DELETE_VERBOSE="--verbose"
SHIFT
goto parse_delete_args
@@ -1787,7 +1810,7 @@ if "!DELETE_CONFIG!"=="" (
-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 delete -name !DELETE_NAME! -deleteConfig
!DELETE_CONFIG! ^
--solrUrl !SOLR_URL_SCHEME!://%SOLR_TOOL_HOST%:!DELETE_PORT!/solr
%DELETE_VERBOSE%
+--solr-url !SOLR_URL_SCHEME!://%SOLR_TOOL_HOST%:!DELETE_PORT!/solr
%DELETE_VERBOSE%
goto done
@@ -1839,6 +1862,8 @@ IF "%1"=="-upconfig" (
goto zk_usage
) ELSE IF "%1"=="-help" (
goto zk_usage
+) ELSE IF "%1"=="--help" (
+ goto zk_usage
) ELSE IF "!ZK_SRC!"=="" (
if not "%~1"=="" (
goto set_zk_src
@@ -2043,6 +2068,8 @@ goto done
:run_auth
+IF "%1"=="-h" goto usage
+IF "%1"=="--help" goto usage
IF "%1"=="-help" goto usage
IF "%1"=="-usage" goto usage
diff --git a/solr/core/src/java/org/apache/solr/cli/AuthTool.java
b/solr/core/src/java/org/apache/solr/cli/AuthTool.java
index 818b72a5586..29819f5d8a5 100644
--- a/solr/core/src/java/org/apache/solr/cli/AuthTool.java
+++ b/solr/core/src/java/org/apache/solr/cli/AuthTool.java
@@ -115,7 +115,7 @@ public class AuthTool extends ToolBase {
.argName("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.")
.deprecated(
new DeprecatedAttributes.Builder()
.setForRemoval(true)
diff --git a/solr/core/src/java/org/apache/solr/cli/PackageTool.java
b/solr/core/src/java/org/apache/solr/cli/PackageTool.java
index cc86e730cf0..8a833c7fa67 100644
--- a/solr/core/src/java/org/apache/solr/cli/PackageTool.java
+++ b/solr/core/src/java/org/apache/solr/cli/PackageTool.java
@@ -215,7 +215,7 @@ public class PackageTool extends ToolBase {
} else {
printRed(
- "Either specify --cluster to undeploy cluster level
plugins or -collections <list-of-collections> to undeploy collection level
plugins");
+ "Either specify --cluster to undeploy cluster level
plugins or --collections <list-of-collections> to undeploy collection level
plugins");
}
break;
}
diff --git a/solr/core/src/java/org/apache/solr/cli/SolrCLI.java
b/solr/core/src/java/org/apache/solr/cli/SolrCLI.java
index 19e50f3d27d..a87913122a7 100755
--- a/solr/core/src/java/org/apache/solr/cli/SolrCLI.java
+++ b/solr/core/src/java/org/apache/solr/cli/SolrCLI.java
@@ -202,14 +202,14 @@ public class SolrCLI implements CLIO {
final boolean hasNoCommand =
args == null || args.length == 0 || args[0] == null ||
args[0].trim().isEmpty();
final boolean isHelpCommand =
- !hasNoCommand && Arrays.asList("-h", "--help", "/?").contains(args[0]);
+ !hasNoCommand && Arrays.asList("-h", "--help", "-help",
"/?").contains(args[0]);
if (hasNoCommand || isHelpCommand) {
printHelp();
exit(1);
}
- if (Arrays.asList("-v", "-version", "version").contains(args[0])) {
+ if (Arrays.asList("-v", "-version", "--version",
"version").contains(args[0])) {
// select the version tool to be run
args[0] = "version";
}
diff --git a/solr/core/src/java/org/apache/solr/cloud/ZkCLI.java
b/solr/core/src/java/org/apache/solr/cloud/ZkCLI.java
index 2906d964176..6b67fc76360 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ZkCLI.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ZkCLI.java
@@ -36,12 +36,14 @@ import java.util.regex.Pattern;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
+import org.apache.commons.cli.DeprecatedAttributes;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser;
import org.apache.solr.cli.CLIO;
+import org.apache.solr.cli.SolrCLI;
import org.apache.solr.client.solrj.impl.SolrZkClientTimeout;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.cloud.ClusterProperties;
@@ -67,17 +69,58 @@ public class ZkCLI implements CLIO {
private static final String GET_FILE = "getfile";
private static final String DOWNCONFIG = "downconfig";
private static final String ZK_CLI_NAME = "ZkCLI";
- private static final String HELP = "help";
private static final String LINKCONFIG = "linkconfig";
+
+ /**
+ * @deprecated Replaced by CONF_DIR.
+ */
+ @Deprecated(since = "9.7")
private static final String CONFDIR = "confdir";
+
+ private static final String CONF_DIR = "conf-dir";
+
+ /**
+ * @deprecated Replaced by CONF_NAME.
+ */
+ @Deprecated(since = "9.7")
private static final String CONFNAME = "confname";
+
+ private static final String CONF_NAME = "conf-name";
+
+ /**
+ * @deprecated Replaced by ZK_HOST.
+ */
+ @Deprecated(since = "9.7")
private static final String ZKHOST = "zkhost";
+
+ private static final String ZK_HOST = "zk-host";
+
+ /**
+ * @deprecated Replaced by RUN_ZK.
+ */
+ @Deprecated(since = "9.7")
private static final String RUNZK = "runzk";
+
+ private static final String RUN_ZK = "run-zk";
+
+ /**
+ * @deprecated Replaced by SOLR_HOME.
+ */
+ @Deprecated(since = "9.7")
private static final String SOLRHOME = "solrhome";
+
+ private static final String SOLR_HOME = "solr-home";
private static final String BOOTSTRAP = "bootstrap";
static final String UPCONFIG = "upconfig";
static final String EXCLUDE_REGEX_SHORT = "x";
- static final String EXCLUDE_REGEX = "excluderegex";
+
+ /**
+ * @deprecated Replaced by EXCLUDE_REGEX.
+ */
+ @Deprecated(since = "9.7")
+ static final String EXCLUDEREGEX = "excluderegex";
+
+ static final String EXCLUDE_REGEX = "exclude-regex";
static final String EXCLUDE_REGEX_DEFAULT =
ConfigSetService.UPLOAD_FILENAME_EXCLUDE_REGEX;
private static final String COLLECTION = "collection";
private static final String CLEAR = "clear";
@@ -86,7 +129,6 @@ public class ZkCLI implements CLIO {
private static final String CMD = "cmd";
private static final String CLUSTERPROP = "clusterprop";
private static final String UPDATEACLS = "updateacls";
- private static final String VERBOSE = "verbose";
@VisibleForTesting
public static void setStdout(PrintStream stdout) {
@@ -119,7 +161,8 @@ public class ZkCLI implements CLIO {
CommandLineParser parser = new PosixParser();
Options options = new Options();
- options.addOption(
+
+ Option cmdOption =
Option.builder(CMD)
.hasArg(true)
.desc(
@@ -149,119 +192,259 @@ public class ZkCLI implements CLIO {
+ UPDATEACLS
+ ", "
+ LS)
- .build());
-
- Option zkHostOption = new Option("z", ZKHOST, true, "ZooKeeper host
address");
+ .build();
+ options.addOption(cmdOption);
+
+ Option zkHostDepOption =
+ Option.builder(ZKHOST)
+ .argName("zkHost")
+ .hasArg()
+ .desc("ZooKeeper host address")
+ .deprecated(
+ DeprecatedAttributes.builder()
+ .setForRemoval(true)
+ .setSince("9.7")
+ .setDescription("Use --zk-host instead")
+ .get())
+ .build();
+ options.addOption(zkHostDepOption);
+
+ Option zkHostOption =
+ Option.builder("z")
+ .longOpt(ZK_HOST)
+ .argName("zkHost")
+ .hasArg()
+ .desc("ZooKeeper host address")
+ .build();
options.addOption(zkHostOption);
+
+ Option solrHomeDepOption =
+ Option.builder(SOLRHOME)
+ .hasArg()
+ .desc("for " + BOOTSTRAP + ", " + RUNZK + ": solrhome location")
+ .deprecated(
+ DeprecatedAttributes.builder()
+ .setForRemoval(true)
+ .setSince("9.7")
+ .setDescription("Use --solr-home instead")
+ .get())
+ .build();
+ options.addOption(solrHomeDepOption);
+
Option solrHomeOption =
- new Option("s", SOLRHOME, true, "for " + BOOTSTRAP + ", " + RUNZK + ":
solrhome location");
+ Option.builder("s")
+ .longOpt(SOLR_HOME)
+ .hasArg()
+ .desc("for " + BOOTSTRAP + ", " + RUNZK + ": solr-home location")
+ .build();
options.addOption(solrHomeOption);
- options.addOption(
- "d", CONFDIR, true, "for " + UPCONFIG + ": a directory of
configuration files");
- options.addOption(
- "n", CONFNAME, true, "for " + UPCONFIG + ", " + LINKCONFIG + ": name
of the config set");
-
- options.addOption("c", COLLECTION, true, "for " + LINKCONFIG + ": name of
the collection");
+ Option confDirDepOption =
+ Option.builder(CONFDIR)
+ .hasArg()
+ .argName("DIR")
+ .desc("for " + UPCONFIG + ": a directory of configuration files")
+ .deprecated(
+ DeprecatedAttributes.builder()
+ .setForRemoval(true)
+ .setSince("9.7")
+ .setDescription("Use --conf-dir instead")
+ .get())
+ .build();
+ options.addOption(confDirDepOption);
+
+ Option confDirOption =
+ Option.builder("d")
+ .longOpt(CONF_DIR)
+ .hasArg()
+ .argName("DIR")
+ .desc("for " + UPCONFIG + ": a directory of configuration files")
+ .build();
+ options.addOption(confDirOption);
+
+ Option confNameDepOption =
+ Option.builder(CONFNAME)
+ .hasArg()
+ .argName("NAME")
+ .desc("for " + UPCONFIG + ", " + LINKCONFIG + ": name of the
config set")
+ .deprecated(
+ DeprecatedAttributes.builder()
+ .setForRemoval(true)
+ .setSince("9.7")
+ .setDescription("Use --conf-name instead")
+ .get())
+ .build();
+ options.addOption(confNameDepOption);
+
+ Option confNameOption =
+ Option.builder("n")
+ .longOpt(CONF_NAME)
+ .hasArg()
+ .argName("NAME")
+ .desc("for " + UPCONFIG + ", " + LINKCONFIG + ": name of the
config set")
+ .build();
+ options.addOption(confNameOption);
+
+ Option collectionOption =
+ Option.builder("c")
+ .longOpt(COLLECTION)
+ .hasArg()
+ .argName("NAME")
+ .desc("for " + LINKCONFIG + ": name of the collection")
+ .build();
+ options.addOption(collectionOption);
+
+ Option excludeRegexDepOption =
+ Option.builder(EXCLUDEREGEX)
+ .hasArg()
+ .argName("<true/false>")
+ .desc("for " + UPCONFIG + ": files matching this regular
expression won't be uploaded")
+ .deprecated(
+ DeprecatedAttributes.builder()
+ .setForRemoval(true)
+ .setSince("9.7")
+ .setDescription("Use --exclude-regex instead")
+ .get())
+ .build();
+ options.addOption(excludeRegexDepOption);
+
+ Option excludeRegexOption =
+ Option.builder(EXCLUDE_REGEX_SHORT)
+ .longOpt(EXCLUDE_REGEX)
+ .hasArg()
+ .argName("<true/false>")
+ .desc("for " + UPCONFIG + ": files matching this regular
expression won't be uploaded")
+ .build();
+ options.addOption(excludeRegexOption);
+
+ Option runZkDepOption =
+ Option.builder(RUNZK)
+ .hasArg()
+ .argName("<true/false>")
+ .desc(
+ "run zk internally by passing the solr run port - only for
clusters on one machine (tests, dev)")
+ .deprecated(
+ DeprecatedAttributes.builder()
+ .setForRemoval(true)
+ .setSince("9.7")
+ .setDescription("Use --run-zk instead")
+ .get())
+ .build();
+ options.addOption(runZkDepOption);
+
+ Option runZkOption =
+ Option.builder("r")
+ .longOpt(RUN_ZK)
+ .hasArg()
+ .argName("<true/false>")
+ .desc(
+ "run zk internally by passing the solr run port - only for
clusters on one machine (tests, dev)")
+ .build();
+ options.addOption(runZkOption);
- options.addOption(
- EXCLUDE_REGEX_SHORT,
- EXCLUDE_REGEX,
- true,
- "for " + UPCONFIG + ": files matching this regular expression won't be
uploaded");
+ Option clusterNameOption =
+ Option.builder(NAME).hasArg().desc("name of the cluster property to
set").build();
+ options.addOption(clusterNameOption);
- options.addOption(
- "r",
- RUNZK,
- true,
- "run zk internally by passing the solr run port - only for clusters on
one machine (tests, dev)");
+ Option clusterValueOption =
+ Option.builder(VALUE_LONG).hasArg().desc("value of the cluster to
set").build();
+ options.addOption(clusterValueOption);
- options.addOption("h", HELP, false, "bring up this help page");
- options.addOption(NAME, true, "name of the cluster property to set");
- options.addOption(VALUE_LONG, true, "value of the cluster to set");
- options.addOption("v", VERBOSE, false, "enable verbose mode");
+ options.addOption(SolrCLI.OPTION_HELP);
+ options.addOption(SolrCLI.OPTION_VERBOSE);
try {
// parse the command line arguments
CommandLine line = parser.parse(options, args);
- if ((line.hasOption(HELP) || !line.hasOption(ZKHOST) ||
!line.hasOption(CMD))
- && !line.hasOption(VERBOSE)) {
+ if ((line.hasOption(SolrCLI.OPTION_HELP)
+ || (!line.hasOption(ZK_HOST) && !line.hasOption(ZKHOST))
+ || !line.hasOption(CMD))
+ && !line.hasOption(SolrCLI.OPTION_VERBOSE)) {
// automatically generate the help statement
HelpFormatter formatter = new HelpFormatter();
formatter.printHelp(ZK_CLI_NAME, options);
stdout.println("Examples:");
stdout.println(
- "zkcli.sh -zkhost localhost:9983 -cmd " + BOOTSTRAP + " -" +
SOLRHOME + " /opt/solr");
+ "zkcli.sh --zk-host localhost:9983 -cmd "
+ + BOOTSTRAP
+ + " --"
+ + SOLR_HOME
+ + " /opt/solr");
stdout.println(
- "zkcli.sh -zkhost localhost:9983 -cmd "
+ "zkcli.sh --zk-host localhost:9983 -cmd "
+ UPCONFIG
- + " -"
- + CONFDIR
+ + " --"
+ + CONF_DIR
+ " /opt/solr/collection1/conf"
- + " -"
- + CONFNAME
+ + " --"
+ + CONF_NAME
+ " myconf");
stdout.println(
- "zkcli.sh -zkhost localhost:9983 -cmd "
+ "zkcli.sh --zk-host localhost:9983 -cmd "
+ DOWNCONFIG
- + " -"
- + CONFDIR
+ + " --"
+ + CONF_DIR
+ " /opt/solr/collection1/conf"
- + " -"
- + CONFNAME
+ + " --"
+ + CONF_NAME
+ " myconf");
stdout.println(
- "zkcli.sh -zkhost localhost:9983 -cmd "
+ "zkcli.sh --zk-host localhost:9983 -cmd "
+ LINKCONFIG
- + " -"
+ + " --"
+ COLLECTION
+ " collection1"
- + " -"
- + CONFNAME
+ + " --"
+ + CONF_NAME
+ " myconf");
- stdout.println("zkcli.sh -zkhost localhost:9983 -cmd " + MAKEPATH + "
/apache/solr");
- stdout.println("zkcli.sh -zkhost localhost:9983 -cmd " + PUT + "
/solr.conf 'conf data'");
+ stdout.println("zkcli.sh --zk-host localhost:9983 -cmd " + MAKEPATH +
" /apache/solr");
+ stdout.println("zkcli.sh --zk-host localhost:9983 -cmd " + PUT + "
/solr.conf 'conf data'");
stdout.println(
- "zkcli.sh -zkhost localhost:9983 -cmd "
+ "zkcli.sh --zk-host localhost:9983 -cmd "
+ PUT_FILE
+ " /solr.xml /User/myuser/solr/solr.xml");
- stdout.println("zkcli.sh -zkhost localhost:9983 -cmd " + GET + "
/solr.xml");
+ stdout.println("zkcli.sh --zk-host localhost:9983 -cmd " + GET + "
/solr.xml");
stdout.println(
- "zkcli.sh -zkhost localhost:9983 -cmd " + GET_FILE + " /solr.xml
solr.xml.file");
- stdout.println("zkcli.sh -zkhost localhost:9983 -cmd " + CLEAR + "
/solr");
- stdout.println("zkcli.sh -zkhost localhost:9983 -cmd " + LIST);
- stdout.println("zkcli.sh -zkhost localhost:9983 -cmd " + LS + "
/solr/live_nodes");
+ "zkcli.sh --zk-host localhost:9983 -cmd " + GET_FILE + " /solr.xml
solr.xml.file");
+ stdout.println("zkcli.sh --zk-host localhost:9983 -cmd " + CLEAR + "
/solr");
+ stdout.println("zkcli.sh --zk-host localhost:9983 -cmd " + LIST);
+ stdout.println("zkcli.sh --zk-host localhost:9983 -cmd " + LS + "
/solr/live_nodes");
stdout.println(
- "zkcli.sh -zkhost localhost:9983 -cmd "
+ "zkcli.sh --zk-host localhost:9983 -cmd "
+ CLUSTERPROP
- + " -"
+ + " --"
+ NAME
- + " urlScheme -"
+ + " urlScheme --"
+ VALUE_LONG
+ " https");
- stdout.println("zkcli.sh -zkhost localhost:9983 -cmd " + UPDATEACLS +
" /solr");
+ stdout.println("zkcli.sh --zk-host localhost:9983 -cmd " + UPDATEACLS
+ " /solr");
return;
}
// start up a tmp zk server first
- String zkServerAddress = line.getOptionValue(ZKHOST);
- String solrHome = line.getOptionValue(SOLRHOME);
+ String zkServerAddress =
+ line.hasOption(ZK_HOST) ? line.getOptionValue(ZK_HOST) :
line.getOptionValue(ZKHOST);
+ String solrHome =
+ line.hasOption(SOLR_HOME)
+ ? line.getOptionValue(SOLR_HOME)
+ : line.getOptionValue(SOLRHOME);
if (StrUtils.isNullOrEmpty(solrHome)) {
solrHome = System.getProperty("solr.home");
}
- if (line.hasOption(VERBOSE)) {
+ if (line.hasOption(SolrCLI.OPTION_VERBOSE)) {
stdout.println("Using " + SOLRHOME + "=" + solrHome);
return;
}
String solrPort = null;
- if (line.hasOption(RUNZK)) {
- if (!line.hasOption(SOLRHOME)) {
- stdout.println("-" + SOLRHOME + " is required for " + RUNZK);
+ if (line.hasOption(RUNZK) || line.hasOption(RUN_ZK)) {
+ if (!line.hasOption(SOLR_HOME) && !line.hasOption(SOLRHOME)) {
+ stdout.println("--" + SOLR_HOME + " is required for " + RUN_ZK);
System.exit(1);
}
- solrPort = line.getOptionValue(RUNZK);
+ solrPort =
+ line.hasOption(RUN_ZK) ? line.getOptionValue(RUN_ZK) :
line.getOptionValue(RUNZK);
}
SolrZkServer zkServer = null;
@@ -319,8 +502,8 @@ public class ZkCLI implements CLIO {
.withStateFileCompression(minStateByteLenForCompression,
compressor)
.build()) {
if (line.getOptionValue(CMD).equalsIgnoreCase(BOOTSTRAP)) {
- if (!line.hasOption(SOLRHOME)) {
- stdout.println("-" + SOLRHOME + " is required for " + BOOTSTRAP);
+ if (!line.hasOption(SOLR_HOME) && !line.hasOption(SOLRHOME)) {
+ stdout.println("--" + SOLR_HOME + " is required for " + BOOTSTRAP);
System.exit(1);
}
@@ -338,13 +521,24 @@ public class ZkCLI implements CLIO {
// up in the first place...
} else if (line.getOptionValue(CMD).equalsIgnoreCase(UPCONFIG)) {
- if (!line.hasOption(CONFDIR) || !line.hasOption(CONFNAME)) {
- stdout.println("-" + CONFDIR + " and -" + CONFNAME + " are
required for " + UPCONFIG);
+ if ((!line.hasOption(CONF_DIR) && !line.hasOption(CONFDIR))
+ || (!line.hasOption(CONF_NAME) && !line.hasOption(CONFNAME))) {
+ stdout.println(
+ "--" + CONF_DIR + " and --" + CONF_NAME + " are required for "
+ UPCONFIG);
System.exit(1);
}
- String confDir = line.getOptionValue(CONFDIR);
- String confName = line.getOptionValue(CONFNAME);
- final String excludeExpr = line.getOptionValue(EXCLUDE_REGEX,
EXCLUDE_REGEX_DEFAULT);
+ String confDir =
+ line.hasOption(CONF_DIR)
+ ? line.getOptionValue(CONF_DIR)
+ : line.getOptionValue(CONFDIR);
+ String confName =
+ line.hasOption(CONF_NAME)
+ ? line.getOptionValue(CONF_NAME)
+ : line.getOptionValue(CONFNAME);
+ final String excludeExpr =
+ line.hasOption(EXCLUDE_REGEX)
+ ? line.getOptionValue(EXCLUDE_REGEX, EXCLUDE_REGEX_DEFAULT)
+ : line.getOptionValue(EXCLUDEREGEX, EXCLUDE_REGEX_DEFAULT);
if (!ZkController.checkChrootPath(zkServerAddress, true)) {
stdout.println("A chroot was specified in zkHost but the znode
doesn't exist. ");
@@ -357,22 +551,34 @@ public class ZkCLI implements CLIO {
ZkMaintenanceUtils.CONFIGS_ZKNODE + "/" + confName,
excludePattern);
} else if (line.getOptionValue(CMD).equalsIgnoreCase(DOWNCONFIG)) {
- if (!line.hasOption(CONFDIR) || !line.hasOption(CONFNAME)) {
- stdout.println("-" + CONFDIR + " and -" + CONFNAME + " are
required for " + DOWNCONFIG);
+ if ((!line.hasOption(CONF_DIR) && !line.hasOption(CONFDIR))
+ || (!line.hasOption(CONF_NAME) && !line.hasOption(CONFNAME))) {
+ stdout.println(
+ "--" + CONF_DIR + " and --" + CONF_NAME + " are required for "
+ DOWNCONFIG);
System.exit(1);
}
- String confDir = line.getOptionValue(CONFDIR);
- String confName = line.getOptionValue(CONFNAME);
+ String confDir =
+ line.hasOption(CONF_DIR)
+ ? line.getOptionValue(CONF_DIR)
+ : line.getOptionValue(CONFDIR);
+ String confName =
+ line.hasOption(CONF_NAME)
+ ? line.getOptionValue(CONF_NAME)
+ : line.getOptionValue(CONFNAME);
ZkMaintenanceUtils.downloadFromZK(
zkClient, ZkMaintenanceUtils.CONFIGS_ZKNODE + "/" + confName,
Paths.get(confDir));
} else if (line.getOptionValue(CMD).equalsIgnoreCase(LINKCONFIG)) {
- if (!line.hasOption(COLLECTION) || !line.hasOption(CONFNAME)) {
+ if (!line.hasOption(COLLECTION)
+ || (!line.hasOption(CONF_NAME) && !line.hasOption(CONFNAME))) {
stdout.println(
- "-" + COLLECTION + " and -" + CONFNAME + " are required for "
+ LINKCONFIG);
+ "--" + COLLECTION + " and --" + CONF_NAME + " are required for
" + LINKCONFIG);
System.exit(1);
}
String collection = line.getOptionValue(COLLECTION);
- String confName = line.getOptionValue(CONFNAME);
+ String confName =
+ line.hasOption(CONF_NAME)
+ ? line.getOptionValue(CONF_NAME)
+ : line.getOptionValue(CONFNAME);
ZkController.linkConfSet(zkClient, collection, confName);
} else if (line.getOptionValue(CMD).equalsIgnoreCase(LIST)) {
diff --git a/solr/core/src/test/org/apache/solr/cli/TestSolrCLIRunExample.java
b/solr/core/src/test/org/apache/solr/cli/TestSolrCLIRunExample.java
index e85f7d19d12..4c0d1af4ca8 100644
--- a/solr/core/src/test/org/apache/solr/cli/TestSolrCLIRunExample.java
+++ b/solr/core/src/test/org/apache/solr/cli/TestSolrCLIRunExample.java
@@ -444,7 +444,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
--no-prompt option.
*/
@Test
public void testInteractiveSolrCloudExample() throws Exception {
diff --git a/solr/core/src/test/org/apache/solr/cloud/ZkCLITest.java
b/solr/core/src/test/org/apache/solr/cloud/ZkCLITest.java
index c84d180a6b9..2352e1830e9 100644
--- a/solr/core/src/test/org/apache/solr/cloud/ZkCLITest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/ZkCLITest.java
@@ -117,7 +117,8 @@ public class ZkCLITest extends SolrTestCaseJ4 {
public void testCmdConstants() {
assertEquals("upconfig", ZkCLI.UPCONFIG);
assertEquals("x", ZkCLI.EXCLUDE_REGEX_SHORT);
- assertEquals("excluderegex", ZkCLI.EXCLUDE_REGEX);
+ assertEquals("excluderegex", ZkCLI.EXCLUDEREGEX);
+ assertEquals("exclude-regex", ZkCLI.EXCLUDE_REGEX);
assertEquals(ConfigSetService.UPLOAD_FILENAME_EXCLUDE_REGEX,
ZkCLI.EXCLUDE_REGEX_DEFAULT);
}
diff --git a/solr/docker/scripts/wait-for-solr.sh
b/solr/docker/scripts/wait-for-solr.sh
index 147cc3fd071..0c3ec73f13e 100755
--- a/solr/docker/scripts/wait-for-solr.sh
+++ b/solr/docker/scripts/wait-for-solr.sh
@@ -45,7 +45,7 @@ solr_url="http://localhost:${SOLR_PORT:-8983}"
while (( $# > 0 )); do
case "$1" in
- --help)
+ --help|-h|-help)
cat <<EOM
Usage: $SCRIPT [options]
diff --git a/solr/docker/scripts/wait-for-zookeeper.sh
b/solr/docker/scripts/wait-for-zookeeper.sh
index 88e24a8704d..3aa115b03a3 100755
--- a/solr/docker/scripts/wait-for-zookeeper.sh
+++ b/solr/docker/scripts/wait-for-zookeeper.sh
@@ -89,7 +89,7 @@ max_attempts=120
wait_seconds=2
while (( $# > 0 )); do
case "$1" in
- --help)
+ --help|-h|-help)
cat <<EOM
Usage: $SCRIPT [options] zookeeper-service-name
diff --git a/solr/server/scripts/cloud-scripts/snapshotscli.sh
b/solr/server/scripts/cloud-scripts/snapshotscli.sh
index 16c59837acd..5db119efab7 100755
--- a/solr/server/scripts/cloud-scripts/snapshotscli.sh
+++ b/solr/server/scripts/cloud-scripts/snapshotscli.sh
@@ -165,7 +165,7 @@ case "${cmd}" in
echo "Done. GoodBye!"
;;
- --help)
+ --help|-h|-help)
usage 1>&2
;;
*)
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.adoc
index 6ddec1fad9a..d1d64ba821e 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
@@ -97,7 +97,7 @@ Windows::
The list of available parameters for the Prometheus Exporter.
All parameters can be provided via an environment variable, instead of through
the command line.
-`h`, `--help`::
+`-h`, `--help`::
+
[%autowidth,frame=none]
|===
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.adoc
index 66a8398aa87..76d31daff8c 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
@@ -687,7 +687,7 @@ This defaults to the same name as the core or collection.
+
*Example*: `bin/solr create -n basic`
-`-p <port>` or `-port <port>`::
+`-p <port>` or `--port <port>`::
+
[%autowidth,frame=none]
|===
@@ -758,7 +758,7 @@ Base Solr URL, which can be used in SolrCloud mode to
determine the ZooKeeper co
`bin/solr create_collection [options]`
-`bin/solr create_collection -help`
+`bin/solr create_collection --help`
==== Create Collection Parameters
@@ -809,7 +809,7 @@ UMMMM... I COPIED THE ABOVE LINE FROM bin/solr
create_collection -h output, bu
+
*Example*: `bin/solr create_collection -n basic -c mycoll`
-`-p <port>` or `-port <port>`::
+`-p <port>` or `--port <port>`::
+
[%autowidth,frame=none]
|===
@@ -846,7 +846,7 @@ The default is `1` (no replication).
+
*Example*: `bin/solr create_collection -rf 2`
-`-force`::
+`--force`::
+
[%autowidth,frame=none]
|===
@@ -854,9 +854,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.
+It is possible to override this warning with the --force parameter.
+
-*Example*: `bin/solr create_collection -c foo -force`
+*Example*: `bin/solr create_collection -c foo --force`
=== Create a Core
@@ -864,7 +864,7 @@ The `create_core` command creates a core and is only
available when running in u
`bin/solr create_core [options]`
-`bin/solr create_core -help`
+`bin/solr create_core --help`
==== Create Core Parameters
@@ -894,7 +894,7 @@ Alternatively, you can pass the path to your own
configuration directory instead
+
*Example*: `bin/solr create_collection -c mycore -d /tmp/myconfig`
-`-p <port>` or `-port <port>`::
+`-p <port>` or `--port <port>`::
+
[%autowidth,frame=none]
|===
@@ -908,7 +908,7 @@ This option is useful if you are running multiple Solr
instances on the same hos
+
*Example*: `bin/solr create -p 8983`
-`-force`::
+`--force`::
+
[%autowidth,frame=none]
|===
@@ -916,9 +916,9 @@ This option is useful if you are running multiple Solr
instances on the same hos
|===
+
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.
+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`
==== Configuration Directories and SolrCloud
@@ -1081,7 +1081,7 @@ Usage: solr auth enable [--type basicAuth] --credentials
user:pass [--block-unkn
The command takes the following parameters:
-`-credentials <user:pass>`::
+`--credentials <user:pass>`::
+
[%autowidth,frame=none]
|===
@@ -1115,7 +1115,7 @@ Either `--credentials` or `--prompt` *must* be specified.
When `true`, this blocks out access to unauthenticated users from accessing
Solr.
When `false`, unauthenticated users will still be able to access Solr, but
only for operations not explicitly requiring a user role in the Authorization
plugin configuration.
-`--solrIncludeFile <includeFilePath>`::
+`--solr-include-file <includeFilePath>`::
+
[%autowidth,frame=none]
|===
@@ -1272,7 +1272,7 @@ Unnecessary if `ZK_HOST` is defined in `solr.in.sh` or
`solr.in.cmd`.
+
Base Solr URL, which can be used in SolrCloud mode to determine the ZooKeeper
connection string if that's not known.
-`-s <scheme>` or `-scheme <scheme>`::
+`-s <scheme>` or `--scheme <scheme>`::
+
[%autowidth,frame=none]
|===
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.adoc
index 10600182b8b..b1ea5650bf8 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
@@ -219,5 +219,5 @@ Provide the raw document as a string for indexing.
[,console]
----
-$ bin/solr post -url http://localhost:8983/signals/update -mode args --type
text/csv -out $'id,value\n1,0.47'
+$ bin/solr post -url http://localhost:8983/signals/update -mode args --type
text/csv --out $'id,value\n1,0.47'
----