lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sar...@apache.org
Subject [1/5] lucene-solr:branch_7_4: SOLR-12434: bin/solr {config, healthcheck} ignore ZK_HOST in solr.in.{sh, cmd}
Date Wed, 13 Jun 2018 17:35:38 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/branch_7_4 1e77f4d42 -> 578316d96


SOLR-12434: bin/solr {config,healthcheck} ignore ZK_HOST in solr.in.{sh,cmd}


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/dc4ef0ab
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/dc4ef0ab
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/dc4ef0ab

Branch: refs/heads/branch_7_4
Commit: dc4ef0ab966155224a61c105990aeac4eec26cea
Parents: 1e77f4d
Author: Steve Rowe <sarowe@apache.org>
Authored: Tue Jun 12 20:01:20 2018 -0400
Committer: Steve Rowe <sarowe@apache.org>
Committed: Wed Jun 13 13:32:53 2018 -0400

----------------------------------------------------------------------
 solr/CHANGES.txt                                |  2 +
 solr/bin/solr                                   | 29 ++++++++++++-
 solr/bin/solr.cmd                               | 43 +++++++++++++++++---
 solr/bin/solr.in.cmd                            |  2 +-
 .../src/java/org/apache/solr/util/SolrCLI.java  |  7 ++++
 5 files changed, 75 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/dc4ef0ab/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 32a6a2c..65f5c53 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -288,6 +288,8 @@ Bug Fixes
 
 * SOLR-12445: Upgrade Dropwizard Metrics to version 3.2.6. (ab)
 
+* SOLR-12434: bin/solr {config,healthcheck} ignore ZK_HOST in solr.in.{sh,cmd} (Steve Rowe)
+
 Optimizations
 ----------------------
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/dc4ef0ab/solr/bin/solr
----------------------------------------------------------------------
diff --git a/solr/bin/solr b/solr/bin/solr
index 53cf84d..4ea9d62 100755
--- a/solr/bin/solr
+++ b/solr/bin/solr
@@ -908,7 +908,34 @@ if [ "$SCRIPT_CMD" == "healthcheck" ]; then
 fi
 
 if [[ "$SCRIPT_CMD" == "config" ]]; then
-  run_tool config $*
+  CONFIG_PARAMS=()
+
+  if [ $# -gt 0 ]; then
+    while true; do
+      case "$1" in
+          -z|-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
+              fi
+              ZK_HOST="$2"
+              shift 2
+          ;;
+          -s|-scheme)
+              if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
+                print_usage "$SCRIPT_CMD" "URL scheme is required when using the $1 option!"
+                exit 1
+              fi
+              SOLR_URL_SCHEME="$2"
+              shift 2
+          ;;
+          *)  # Pass through all other params
+              CONFIG_PARAMS+=($1)
+          ;;
+      esac
+    done
+  fi
+  run_tool config -zkHost "$ZK_HOST" -scheme "$SOLR_URL_SCHEME" "${CONFIG_PARAMS[@]}"
   exit $?
 fi
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/dc4ef0ab/solr/bin/solr.cmd
----------------------------------------------------------------------
diff --git a/solr/bin/solr.cmd b/solr/bin/solr.cmd
old mode 100644
new mode 100755
index 7235a4c..0e86fad
--- a/solr/bin/solr.cmd
+++ b/solr/bin/solr.cmd
@@ -208,7 +208,6 @@ IF "%1"=="version" goto get_version
 IF "%1"=="-v" goto get_version
 IF "%1"=="-version" goto get_version
 IF "%1"=="assert" goto run_assert
-if "%1"=="config" goto run_config
 
 REM Only allow the command to be the first argument, assume start if not supplied
 IF "%1"=="start" goto set_script_cmd
@@ -246,12 +245,18 @@ IF "%1"=="zk" (
   set ZK_RECURSE=false
   goto parse_zk_args
 )
-
 IF "%1"=="auth" (
   set SCRIPT_CMD=auth
   SHIFT
   goto run_auth
 )
+IF "%1"=="config" (
+  REM config uses different arg parsing strategy
+  set SCRIPT_CMD=config
+  SHIFT
+  set CONFIG_ARGS=
+  goto parse_config_args
+)
 
 goto parse_args
 
@@ -530,7 +535,7 @@ echo.
 echo.             ^<src^>, ^<dest^> : [file:][/]path/to/local/file or zk:/path/to/zk/node
 echo                              NOTE: ^<src^> and ^<dest^> may both be Zookeeper
resources prefixed by 'zk:'
 echo             When ^<src^> is a zk resource, ^<dest^> may be '.'
-echo             If ^<dest^> ends with '/', then ^<dest^> will be a local folder
or parent znode and the last
+echo             If ^<dest^> ends with '/', then ^<dest^> will be a local folder
or parent znode and the last
 echo             element of the ^<src^> path will be appended unless ^<src^>
also ends in a slash. 
 echo             ^<dest^> may be zk:, which may be useful when using the cp -r form
to backup/restore 
 echo             the entire zk state.
@@ -667,6 +672,7 @@ IF "%1"=="-p" goto set_port
 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"=="-a" goto set_addl_opts
 IF "%1"=="-addlopts" goto set_addl_opts
 IF "%1"=="-j" goto set_addl_jetty_config
@@ -1352,6 +1358,7 @@ IF "%1"=="-c" goto set_healthcheck_collection
 IF "%1"=="-collection" goto set_healthcheck_collection
 IF "%1"=="-z" goto set_healthcheck_zk
 IF "%1"=="-zkhost" goto set_healthcheck_zk
+IF "%1"=="-zkHost" goto set_healthcheck_zk
 IF "%1"=="-help" goto usage
 IF "%1"=="-usage" goto usage
 IF "%1"=="/?" goto usage
@@ -1369,7 +1376,7 @@ SHIFT
 goto parse_healthcheck_args
 
 :set_healthcheck_zk
-set HEALTHCHECK_ZK_HOST=%~2
+set ZK_HOST=%~2
 SHIFT
 SHIFT
 goto parse_healthcheck_args
@@ -1378,10 +1385,11 @@ goto parse_healthcheck_args
 IF NOT DEFINED HEALTHCHECK_COLLECTION goto healthcheck_usage
 IF NOT DEFINED HEALTHCHECK_VERBOSE set "HEALTHCHECK_VERBOSE="
 IF NOT DEFINED HEALTHCHECK_ZK_HOST set "HEALTHCHECK_ZK_HOST=localhost:9983"
+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%\scripts\cloud-scripts\log4j2.xml"
^
   -classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*"
^
-  org.apache.solr.util.SolrCLI healthcheck -collection !HEALTHCHECK_COLLECTION! -zkHost !HEALTHCHECK_ZK_HOST!
%HEALTHCHECK_VERBOSE%
+  org.apache.solr.util.SolrCLI healthcheck -collection !HEALTHCHECK_COLLECTION! -zkHost !ZK_HOST!
%HEALTHCHECK_VERBOSE%
 goto done
 
 :run_assert
@@ -1394,11 +1402,34 @@ if errorlevel 1 (
 )
 goto done
 
+:parse_config_args
+IF [%1]==[] goto run_config
+IF "%1"=="-z" 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
+set "CONFIG_ARGS=!CONFIG_ARGS! %1"
+SHIFT
+goto parse_config_args
+
+:set_config_zk
+set ZK_HOST=%~2
+SHIFT
+SHIFT
+goto parse_config_args
+
+:set_config_url_scheme
+set SOLR_URL_SCHEME=%~2
+SHIFT
+SHIFT
+goto parse_config_args
+
 :run_config
 "%JAVA%" %SOLR_SSL_OPTS% %AUTHC_OPTS% %SOLR_ZK_CREDS_AND_ACLS% -Dsolr.install.dir="%SOLR_TIP%"
^
   -Dlog4j.configurationFile="file:%DEFAULT_SERVER_DIR%\scripts\cloud-scripts\log4j2.xml"
^
   -classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*"
^
-  org.apache.solr.util.SolrCLI %* 
+  org.apache.solr.util.SolrCLI config -zkHost !ZK_HOST! -scheme !SOLR_URL_SCHEME! !CONFIG_ARGS!
 if errorlevel 1 (
    exit /b 1
 )

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/dc4ef0ab/solr/bin/solr.in.cmd
----------------------------------------------------------------------
diff --git a/solr/bin/solr.in.cmd b/solr/bin/solr.in.cmd
old mode 100644
new mode 100755
index 86ad708..226201e
--- a/solr/bin/solr.in.cmd
+++ b/solr/bin/solr.in.cmd
@@ -39,7 +39,7 @@ REM set GC_TUNE=-XX:NewRatio=3 -XX:SurvivorRatio=4     etc.
 REM Set the ZooKeeper connection string if using an external ZooKeeper ensemble
 REM e.g. host1:2181,host2:2181/chroot
 REM Leave empty if not using SolrCloud
-REM set ZK_HOST=
+set ZK_HOST=localhost:2181
 
 REM Set the ZooKeeper client timeout (for SolrCloud mode)
 REM set ZK_CLIENT_TIMEOUT=15000

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/dc4ef0ab/solr/core/src/java/org/apache/solr/util/SolrCLI.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/util/SolrCLI.java b/solr/core/src/java/org/apache/solr/util/SolrCLI.java
old mode 100644
new mode 100755
index 9c7970e..25d0c7b
--- a/solr/core/src/java/org/apache/solr/util/SolrCLI.java
+++ b/solr/core/src/java/org/apache/solr/util/SolrCLI.java
@@ -2532,6 +2532,13 @@ public class SolrCLI {
               .withDescription("Base Solr URL, which can be used to determine the zkHost
if that's not known")
               .create("solrUrl"),
           OptionBuilder
+              .withArgName("HOST")
+              .hasArg()
+              .isRequired(false)
+              .withDescription("Address of the Zookeeper ensemble")
+              .withLongOpt("zkHost")
+              .create('z'),
+          OptionBuilder
               .withArgName("PORT")
               .hasArg()
               .isRequired(false)


Mime
View raw message