You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ep...@apache.org on 2024/04/29 11:11:54 UTC
(solr) branch branch_9x updated: SOLR-16921: use -solrUrl to derive the zk host connection for bin/solr zk subcommands (#2370)
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 9fcc61ce313 SOLR-16921: use -solrUrl to derive the zk host connection for bin/solr zk subcommands (#2370)
9fcc61ce313 is described below
commit 9fcc61ce31315254d62c838f55c776c8abd34546
Author: Eric Pugh <ep...@opensourceconnections.com>
AuthorDate: Mon Apr 29 07:10:13 2024 -0400
SOLR-16921: use -solrUrl to derive the zk host connection for bin/solr zk subcommands (#2370)
---
solr/CHANGES.txt | 2 +-
solr/bin/solr | 49 ++++++----
solr/bin/solr.cmd | 41 ++++++--
.../org/apache/solr/cli/ConfigSetDownloadTool.java | 1 +
.../org/apache/solr/cli/ConfigSetUploadTool.java | 1 +
.../src/java/org/apache/solr/cli/ZkCpTool.java | 1 +
.../src/java/org/apache/solr/cli/ZkLsTool.java | 1 +
.../src/java/org/apache/solr/cli/ZkMkrootTool.java | 1 +
.../src/java/org/apache/solr/cli/ZkMvTool.java | 1 +
.../src/java/org/apache/solr/cli/ZkRmTool.java | 1 +
solr/packaging/test/test_zk.bats | 6 ++
.../pages/solr-control-script-reference.adoc | 107 ++++++++++++++++-----
12 files changed, 161 insertions(+), 51 deletions(-)
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index abbc2cf740d..0f55cdeaf70 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -11,7 +11,7 @@ New Features
Improvements
---------------------
-(No changes)
+* SOLR-16921: use -solrUrl to derive the zk host connection for bin/solr zk subcommands (Eric Pugh)
Optimizations
---------------------
diff --git a/solr/bin/solr b/solr/bin/solr
index 3de4c3ee938..f2029983c18 100755
--- a/solr/bin/solr
+++ b/solr/bin/solr
@@ -593,6 +593,8 @@ function print_usage() {
echo " -z zkHost Optional Zookeeper connection string for all commands. If specified it"
echo " overrides the 'ZK_HOST=...'' defined in solr.in.sh."
echo ""
+ echo " -s solrUrl Optional Solr URL to look up the correct zkHost connection string via."
+ echo ""
echo " -V/-verbose Enable more verbose output for this script."
echo ""
echo " upconfig uploads a configset from the local machine to Zookeeper. (Backcompat: -upconfig)"
@@ -725,12 +727,12 @@ function print_short_zk_usage() {
echo -e "\nERROR: $1\n"
fi
- echo " Usage: solr zk upconfig|downconfig -d <confdir> -n <configName> [-z zkHost]"
- echo " solr zk cp [-r] <src> <dest> [-z zkHost]"
- echo " solr zk rm [-r] <path> [-z zkHost]"
- echo " solr zk mv <src> <dest> [-z zkHost]"
- echo " solr zk ls [-r] <path> [-z zkHost]"
- echo " solr zk mkroot <path> [-z zkHost]"
+ echo " Usage: solr zk upconfig|downconfig -d <confdir> -n <configName> [-z zkHost] [-s solrUrl]"
+ echo " solr zk cp [-r] <src> <dest> [-z zkHost] [-s solrUrl]"
+ 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 ""
if [ "$1" == "" ]; then
@@ -1366,6 +1368,7 @@ ZK_RECURSE=false
if [[ "$SCRIPT_CMD" == "zk" ]]; then
VERBOSE=""
+ ZK_SOLR_URL=""
if [ $# -gt 0 ]; then
while true; do
@@ -1386,6 +1389,13 @@ if [[ "$SCRIPT_CMD" == "zk" ]]; then
ZK_HOST="$2"
shift 2
;;
+ -s|-solrUrl)
+ if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
+ print_short_zk_usage "$SCRIPT_CMD" "Solr Url is required when using the $1 option!"
+ fi
+ ZK_SOLR_URL="$2"
+ shift 2
+ ;;
-n|-confname)
if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
print_short_zk_usage "$SCRIPT_CMD" "Configuration name is required when using the $1 option!"
@@ -1438,11 +1448,7 @@ if [[ "$SCRIPT_CMD" == "zk" ]]; then
if [ -z "$ZK_OP" ]; then
print_short_zk_usage "Zookeeper operation (one of 'upconfig', 'downconfig', 'rm', 'mv', 'cp', 'ls', 'mkroot') is required!"
fi
-
- if [ -z "$ZK_HOST" ]; then
- print_short_zk_usage "Zookeeper address (-z) argument is required or ZK_HOST must be specified in the solr.in.sh file."
- fi
-
+
if [[ "$ZK_OP" == "upconfig" || "$ZK_OP" == "downconfig" ]]; then
if [ -z "$CONFIGSET_CONFDIR" ]; then
print_short_zk_usage "Local directory of the configset (-d) argument is required!"
@@ -1468,37 +1474,44 @@ if [[ "$SCRIPT_CMD" == "zk" ]]; then
fi
fi
+ CONNECTION_PARAMS=""
+
+ if [[ -z "$ZK_HOST" ]]; then
+ CONNECTION_PARAMS="-solrUrl ${ZK_SOLR_URL}"
+ else
+ CONNECTION_PARAMS="-zkHost ${ZK_HOST}"
+ fi
case "$ZK_OP" in
upconfig)
- run_tool "$ZK_OP" -confname "$CONFIGSET_CONFNAME" -confdir "$CONFIGSET_CONFDIR" -zkHost "$ZK_HOST" -configsetsDir "$SOLR_TIP/server/solr/configsets" $VERBOSE
+ run_tool "$ZK_OP" -confname "$CONFIGSET_CONFNAME" -confdir "$CONFIGSET_CONFDIR" $CONNECTION_PARAMS -configsetsDir "$SOLR_TIP/server/solr/configsets" $VERBOSE
;;
downconfig)
- run_tool "$ZK_OP" -confname "$CONFIGSET_CONFNAME" -confdir "$CONFIGSET_CONFDIR" -zkHost "$ZK_HOST" $VERBOSE
+ run_tool "$ZK_OP" -confname "$CONFIGSET_CONFNAME" -confdir "$CONFIGSET_CONFDIR" $CONNECTION_PARAMS $VERBOSE
;;
rm)
if [ -z "$ZK_SRC" ]; then
print_short_zk_usage "Zookeeper path to remove must be specified when using the 'rm' command"
fi
- run_tool "$ZK_OP" -path "$ZK_SRC" -zkHost "$ZK_HOST" -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" -zkHost "$ZK_HOST" $VERBOSE
+ run_tool "$ZK_OP" -src "$ZK_SRC" -dst "$ZK_DST" $CONNECTION_PARAMS $VERBOSE
;;
cp)
- run_tool "$ZK_OP" -src "$ZK_SRC" -dst "$ZK_DST" -zkHost "$ZK_HOST" -recurse "$ZK_RECURSE" $VERBOSE
+ run_tool "$ZK_OP" -src "$ZK_SRC" -dst "$ZK_DST" $CONNECTION_PARAMS -recurse "$ZK_RECURSE" $VERBOSE
;;
ls)
if [ -z "$ZK_SRC" ]; then
print_short_zk_usage "Zookeeper path to list must be specified when using the 'ls' command"
fi
- run_tool "$ZK_OP" -path "$ZK_SRC" -recurse "$ZK_RECURSE" -zkHost "$ZK_HOST" $VERBOSE
+ run_tool "$ZK_OP" -path "$ZK_SRC" -recurse "$ZK_RECURSE" $CONNECTION_PARAMS $VERBOSE
;;
mkroot)
if [ -z "$ZK_SRC" ]; then
print_short_zk_usage "Zookeeper path to list must be specified when using the 'mkroot' command"
fi
- run_tool "$ZK_OP" -path "$ZK_SRC" -zkHost "$ZK_HOST" $VERBOSE
+ run_tool "$ZK_OP" -path "$ZK_SRC" $CONNECTION_PARAMS $VERBOSE
;;
*)
print_short_zk_usage "Unrecognized Zookeeper operation $ZK_OP"
diff --git a/solr/bin/solr.cmd b/solr/bin/solr.cmd
index 3856862137a..a63422d10a8 100755
--- a/solr/bin/solr.cmd
+++ b/solr/bin/solr.cmd
@@ -574,6 +574,8 @@ echo.
echo -z zkHost Optional Zookeeper connection string for all commands. If specified it
echo overrides the 'ZK_HOST=...'' defined in solr.in.cmd.
echo.
+echo -s solrUrl Optional Solr URL to look up the correct zkHost connection string via.
+echo.
echo -V Enable more verbose output.
echo.
echo upconfig uploads a configset from the local machine to Zookeeper. (Backcompat: -upconfig)
@@ -651,12 +653,12 @@ IF NOT "!ERROR_MSG!"=="" (
echo ERROR: !ERROR_MSG!
echo.
)
-echo Usage: solr zk upconfig^|downconfig -d ^<confdir^> -n ^<configName^> [-z zkHost]
-echo solr zk cp [-r] ^<src^> ^<dest^> [-z zkHost]
-echo solr zk rm [-r] ^<path^> [-z zkHost]
-echo solr zk mv ^<src^> ^<dest^> [-z zkHost]
-echo solr zk ls [-r] ^<path^> [-z zkHost]
-echo solr zk mkroot ^<path^> [-z zkHost]
+echo Usage: solr zk upconfig^|downconfig -d ^<confdir^> -n ^<configName^> [-z zkHost] [-s solrUrl]
+echo solr zk cp [-r] ^<src^> ^<dest^> [-z zkHost] [-s solrUrl]
+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.
IF "%ZK_FULL%"=="true" (
goto zk_full_usage
@@ -733,6 +735,8 @@ IF "%1"=="-port" goto set_port
IF "%1"=="-z" goto set_zookeeper
IF "%1"=="-zkhost" goto set_zookeeper
IF "%1"=="-zkHost" goto set_zookeeper
+IF "%1"=="-s" goto set_solr_url
+IF "%1"=="-solrUrl" goto set_solr_url
IF "%1"=="-a" goto set_addl_opts
IF "%1"=="-addlopts" goto set_addl_opts
IF "%1"=="-j" goto set_addl_jetty_config
@@ -954,6 +958,19 @@ SHIFT
SHIFT
goto parse_args
+:set_solr_url
+
+set "arg=%~2"
+IF "%arg%"=="" (
+ set SCRIPT_ERROR=Solr url string is required!
+ goto invalid_cmd_line
+)
+
+set "ZK_SOLR_URL=%~2"
+SHIFT
+SHIFT
+goto parse_args
+
:set_addl_opts
set "arg=%~2"
set "SOLR_ADDL_ARGS=%~2"
@@ -1911,9 +1928,13 @@ IF "!ZK_OP!"=="" (
goto zk_short_usage
)
-IF "!ZK_HOST!"=="" (
- set "ERROR_MSG=Must specify -z zkHost"
- goto zk_short_usage
+set CONNECTION_PARAMS=""
+
+IF "!ZK_OP!"=="" (
+ set CONNECTION_PARAMS="-solrUrl !ZK_SOLR_URL!"
+)
+ELSE (
+ set CONNECTION_PARAMS="-zkHost ZK_HOST!"
)
IF "!ZK_OP!"=="-upconfig" (
@@ -1935,7 +1956,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! -confname !CONFIGSET_NAME! -confdir !CONFIGSET_DIR! %CONNECTION_PARAMS% %ZK_VERBOSE%^
-configsetsDir "%SOLR_TIP%/server/solr/configsets"
) ELSE IF "!ZK_OP!"=="downconfig" (
IF "!CONFIGSET_NAME!"=="" (
diff --git a/solr/core/src/java/org/apache/solr/cli/ConfigSetDownloadTool.java b/solr/core/src/java/org/apache/solr/cli/ConfigSetDownloadTool.java
index db53006d124..45966599279 100644
--- a/solr/core/src/java/org/apache/solr/cli/ConfigSetDownloadTool.java
+++ b/solr/core/src/java/org/apache/solr/cli/ConfigSetDownloadTool.java
@@ -57,6 +57,7 @@ public class ConfigSetDownloadTool extends ToolBase {
.desc("Local directory with configs.")
.build(),
SolrCLI.OPTION_ZKHOST,
+ SolrCLI.OPTION_SOLRURL,
SolrCLI.OPTION_VERBOSE);
}
diff --git a/solr/core/src/java/org/apache/solr/cli/ConfigSetUploadTool.java b/solr/core/src/java/org/apache/solr/cli/ConfigSetUploadTool.java
index 35e3786ee5a..ffeb17d1907 100644
--- a/solr/core/src/java/org/apache/solr/cli/ConfigSetUploadTool.java
+++ b/solr/core/src/java/org/apache/solr/cli/ConfigSetUploadTool.java
@@ -64,6 +64,7 @@ public class ConfigSetUploadTool extends ToolBase {
.desc("Parent directory of example configsets.")
.build(),
SolrCLI.OPTION_ZKHOST,
+ SolrCLI.OPTION_SOLRURL,
SolrCLI.OPTION_VERBOSE);
}
diff --git a/solr/core/src/java/org/apache/solr/cli/ZkCpTool.java b/solr/core/src/java/org/apache/solr/cli/ZkCpTool.java
index 5d26502b5e5..264e8c08849 100644
--- a/solr/core/src/java/org/apache/solr/cli/ZkCpTool.java
+++ b/solr/core/src/java/org/apache/solr/cli/ZkCpTool.java
@@ -56,6 +56,7 @@ public class ZkCpTool extends ToolBase {
.build(),
SolrCLI.OPTION_RECURSE,
SolrCLI.OPTION_ZKHOST,
+ SolrCLI.OPTION_SOLRURL,
SolrCLI.OPTION_VERBOSE);
}
diff --git a/solr/core/src/java/org/apache/solr/cli/ZkLsTool.java b/solr/core/src/java/org/apache/solr/cli/ZkLsTool.java
index 530b1ad852d..6809f8a7a11 100644
--- a/solr/core/src/java/org/apache/solr/cli/ZkLsTool.java
+++ b/solr/core/src/java/org/apache/solr/cli/ZkLsTool.java
@@ -49,6 +49,7 @@ public class ZkLsTool extends ToolBase {
.build(),
SolrCLI.OPTION_RECURSE,
SolrCLI.OPTION_ZKHOST,
+ SolrCLI.OPTION_SOLRURL,
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.java
index ef8330e12d9..26ff3cc45dc 100644
--- a/solr/core/src/java/org/apache/solr/cli/ZkMkrootTool.java
+++ b/solr/core/src/java/org/apache/solr/cli/ZkMkrootTool.java
@@ -48,6 +48,7 @@ public class ZkMkrootTool extends ToolBase {
.desc("Path to create.")
.build(),
SolrCLI.OPTION_ZKHOST,
+ SolrCLI.OPTION_SOLRURL,
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.java
index 67c480817cc..5578c59e777 100644
--- a/solr/core/src/java/org/apache/solr/cli/ZkMvTool.java
+++ b/solr/core/src/java/org/apache/solr/cli/ZkMvTool.java
@@ -56,6 +56,7 @@ public class ZkMvTool extends ToolBase {
.desc("Destination Znode to move to.")
.build(),
SolrCLI.OPTION_ZKHOST,
+ SolrCLI.OPTION_SOLRURL,
SolrCLI.OPTION_VERBOSE);
}
diff --git a/solr/core/src/java/org/apache/solr/cli/ZkRmTool.java b/solr/core/src/java/org/apache/solr/cli/ZkRmTool.java
index f8ec453514b..f2590e3a347 100644
--- a/solr/core/src/java/org/apache/solr/cli/ZkRmTool.java
+++ b/solr/core/src/java/org/apache/solr/cli/ZkRmTool.java
@@ -51,6 +51,7 @@ public class ZkRmTool extends ToolBase {
.build(),
SolrCLI.OPTION_RECURSE,
SolrCLI.OPTION_ZKHOST,
+ SolrCLI.OPTION_SOLRURL,
SolrCLI.OPTION_VERBOSE);
}
diff --git a/solr/packaging/test/test_zk.bats b/solr/packaging/test/test_zk.bats
index 65cb75a1390..723b8e57830 100644
--- a/solr/packaging/test/test_zk.bats
+++ b/solr/packaging/test/test_zk.bats
@@ -47,6 +47,12 @@ teardown() {
assert_output --partial "aliases.json"
}
+@test "get zk host using solr url" {
+ sleep 1
+ run solr zk ls / -solrUrl http://localhost:${SOLR_PORT}
+ assert_output --partial "aliases.json"
+}
+
@test "copying files around" {
touch myfile.txt
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 b12a0f88a7f..6c08a17d66e 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
@@ -188,7 +188,7 @@ If you want to accept all of the defaults, you can simply add the `-noprompt` op
+
Specify the port to start the Solr HTTP listener on; with the classic default port for Solr being 8983.
The specified port (SOLR_PORT) will also be used to determine the stop port.
-The stop port is defined as STOP_PORT=($SOLR_PORT-1000) and JMX RMI listen port is defined as RMI_PORT=($SOLR_PORT+10000).
+The stop port is defined as STOP_PORT=($SOLR_PORT-1000) and JMX RMI listen port is defined as RMI_PORT=($SOLR_PORT+10000).
For instance, if you set -p 8985, then the STOP_PORT=7985 and RMI_PORT=18985.
If this is not specified, `8983` will be used.
+
@@ -208,7 +208,7 @@ If set, the specified directory should contain a solr.xml file, unless solr.xml
+
This parameter is ignored when running examples (`-e`), as the `solr.solr.home` depends on which example is run.
+
-The default value is `server/solr`.
+The default value is `server/solr`.
If passed relative dir, validation with current dir will be done, before trying default `server/<dir>`.
+
*Example*: `bin/solr start -s newHome`
@@ -641,9 +641,9 @@ The `bin/solr` script can also help you create new collections or cores, or dele
=== Create a Core or Collection
-The `create` command creates a core or collection depending on whether Solr is running in standalone (core) or SolrCloud mode (collection).
+The `create` command creates a core or collection depending on whether Solr is running in standalone (core) or SolrCloud mode (collection).
In other words, this action detects which mode Solr is running in, and then takes the appropriate action (either `create_core` or `create_collection`).
-
+
`bin/solr create [options]`
`bin/solr create -help`
@@ -738,8 +738,8 @@ It is possible to override this warning with the -force parameter.
=== Create a Collection
-The `create_collection` command creates a collection, and is only available when running in SolrCloud mode.
-
+The `create_collection` command creates a collection, and is only available when running in SolrCloud mode.
+
`bin/solr create_collection [options]`
`bin/solr create_collection -help`
@@ -776,7 +776,7 @@ Alternatively, you can pass the path to your own configuration directory instead
+
*Example*: `bin/solr create_collection -c mycoll -d /tmp/myconfig`
+
-By default the script will upload the specified confdir directory into Zookeeper using the same name as the collection (-c) option.
+By default the script will upload the specified confdir directory into Zookeeper using the same name as the collection (-c) option.
Alternatively, if you want to reuse an existing directory or create a confdir in Zookeeper that can be shared by multiple collections, use the -n option
+
@@ -844,8 +844,8 @@ It is possible to override this warning with the -force parameter.
=== Create a Core
-The `create_core` command creates a core and is only available when running in user-managed (single-node) mode.
-
+The `create_core` command creates a core and is only available when running in user-managed (single-node) mode.
+
`bin/solr create_core [options]`
`bin/solr create_core -help`
@@ -1003,10 +1003,10 @@ This option is useful if you are running multiple Solr instances on the same hos
The `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
@@ -1051,7 +1051,7 @@ The command takes the following parameters:
|Optional |Default: none
|===
+
-The username and password in the format of `username:password` of the initial user.
+The username and password in the format of `username:password` of the initial user.
Applicable for basicAuth only.
+
If you prefer not to pass the username and password as an argument to the script, you can choose the `-prompt` option.
@@ -1270,12 +1270,12 @@ The basic usage of bin/solr zk is:
[source,plain]
----
$ bin/solr zk -h
-Usage: solr zk upconfig|downconfig -d <confdir> -n <configName> [-z zkHost]
- solr zk cp [-r] <src> <dest> [-z zkHost]
- solr zk rm [-r] <path> [-z zkHost]
- solr zk mv <src> <dest> [-z zkHost]
- solr zk ls [-r] <path> [-z zkHost]
- solr zk mkroot <path> [-z zkHost]
+Usage: solr zk upconfig|downconfig -d <confdir> -n <configName> [-z zkHost] [-s solrUrl]
+ solr zk cp [-r] <src> <dest> [-z zkHost] [-s solrUrl]
+ solr zk rm [-r] <path> [-z zkHost] [-s solrUrl]
+ solr zk mv <src> <dest> [-z zkHost] [-s solrUrl]
+ solr zk ls [-r] <path> [-z zkHost] [-s solrUrl]
+ solr zk mkroot <path> [-z zkHost] [-s solrUrl]
----
NOTE: Solr should have been started at least once before issuing these commands to initialize ZooKeeper with the znodes Solr expects.
@@ -1336,6 +1336,15 @@ 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>`::
++
+[%autowidth,frame=none]
+|===
+|Optional |Default: `http://localhost:8983`
+|===
++
+Base Solr URL, which can be used in SolrCloud mode to determine the ZooKeeper connection string if that's not known.
+
An example of this command with all of the parameters is:
[source,bash]
@@ -1399,6 +1408,15 @@ Unnecessary if `ZK_HOST` is defined in `solr.in.sh` or `solr.in.cmd`.
+
*Example*: `-z 123.321.23.43:2181`
+`-solrUrl <url>`::
++
+[%autowidth,frame=none]
+|===
+|Optional |Default: `http://localhost:8983`
+|===
++
+Base Solr URL, which can be used in SolrCloud mode to determine the ZooKeeper connection string if that's not known.
+
An example of this command with all parameters is:
[source,bash]
@@ -1474,10 +1492,19 @@ Optional if `ZK_HOST` is defined in `solr.in.sh` or `solr.in.cmd`.
+
*Example*: `-z 123.321.23.43:2181`
-When `<src>` is a zk resource, `<dest>` may be '.'.
-If `<dest>` ends with '/', then `<dest>` will be a local folder or parent znode and the last element of the <src> path will be appended unless `<src>` also ends in a slash.
+`-solrUrl <url>`::
++
+[%autowidth,frame=none]
+|===
+|Optional |Default: `http://localhost:8983`
+|===
++
+Base Solr URL, which can be used in SolrCloud mode to determine the ZooKeeper connection string if that's not known.
+
+When `<src>` is a zk resource, `<dest>` may be '.'.
+If `<dest>` ends with '/', then `<dest>` will be a local folder or parent znode and the last element of the <src> path will be appended unless `<src>` also ends in a slash.
`<dest>` may be `zk:`, which may be useful when using the `cp -r` form to backup/restore the entire zk state.
-You must enclose local paths that end in a wildcard in quotes or just end the local path in a slash.
+You must enclose local paths that end in a wildcard in quotes or just end the local path in a slash.
That is, `bin/solr zk cp -r /some/dir/ zk:/ -z localhost:2181` is equivalent to `bin/solr zk cp -r "/some/dir/*" zk:/ -z localhost:2181` but `bin/solr zk cp -r /some/dir/\* zk:/ -z localhost:2181` will throw an error.
Here's an example of backup/restore for a ZK configuration:
@@ -1548,6 +1575,15 @@ Optional if `ZK_HOST` is defined in `solr.in.sh` or `solr.in.cmd`.
+
*Example*: `-z 123.321.23.43:2181`
+`-solrUrl <url>`::
++
+[%autowidth,frame=none]
+|===
+|Optional |Default: `http://localhost:8983`
+|===
++
+Base Solr URL, which can be used in SolrCloud mode to determine the ZooKeeper connection string if that's not known.
+
Examples of this command with the parameters are:
`bin/solr zk rm -r /configs`
@@ -1601,6 +1637,15 @@ An example of this command is:
`bin/solr zk mv /configs/oldconfigset /configs/newconfigset`
+`-solrUrl <url>`::
++
+[%autowidth,frame=none]
+|===
+|Optional |Default: `http://localhost:8983`
+|===
++
+Base Solr URL, which can be used in SolrCloud mode to determine the ZooKeeper connection string if that's not known.
+
=== List a ZooKeeper znode's Children
@@ -1643,11 +1688,20 @@ Optional if `ZK_HOST` is defined in `solr.in.sh` or `solr.in.cmd`.
+
*Example*: `-z 123.321.23.43:2181`
+`-solrUrl <url>`::
++
+[%autowidth,frame=none]
+|===
+|Optional |Default: `http://localhost:8983`
+|===
++
+Base Solr URL, which can be used in SolrCloud mode to determine the ZooKeeper connection string if that's not known.
+
An example of this command with the parameters is:
`bin/solr zk ls -r /collections/mycollection`
-`bin/solr zk ls /collections`
+`bin/solr zk ls /collections -s http://localhost:8983`
=== Create a znode (supports chroot)
@@ -1683,6 +1737,15 @@ Optional if `ZK_HOST` is defined in `solr.in.sh` or `solr.in.cmd`.
+
*Example*: `-z 123.321.23.43:2181`
+`-solrUrl <url>`::
++
+[%autowidth,frame=none]
+|===
+|Optional |Default: `http://localhost:8983`
+|===
++
+Base Solr URL, which can be used in SolrCloud mode to determine the ZooKeeper connection string if that's not known.
+
Examples of this command:
`bin/solr zk mkroot /solr -z 123.321.23.43:2181`