Skip to content

Apache Lucene open-source search software

SOLR-7102: bin/solr should activate cloud mode if ZK_HOST is set

Timothy Potter0fa9cf7c5c0c
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 5f06b1c7a4f..62888ed5df3 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -325,6 +325,8 @@ Other Changes
explicit mappings, with this feature you can now add a list and have the mappings
expanded when the update is applied (Timothy Potter, Vitaliy Zhovtyuk, hossman)
+* SOLR-7102: bin/solr should activate cloud mode if ZK_HOST is set (Timothy Potter)
+
================== 5.1.0 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release
diff --git a/solr/bin/solr b/solr/bin/solr
index 13ec07913d7..a3dde95c1f7 100755
--- a/solr/bin/solr
+++ b/solr/bin/solr
@@ -1230,6 +1230,11 @@ else
GC_LOG_OPTS=()
fi
+# If ZK_HOST is defined, the assume SolrCloud mode
+if [[ -n "$ZK_HOST" ]]; then
+ SOLR_MODE="solrcloud"
+fi
+
if [ "$SOLR_MODE" == 'solrcloud' ]; then
if [ -z "$ZK_CLIENT_TIMEOUT" ]; then
ZK_CLIENT_TIMEOUT="15000"
diff --git a/solr/bin/solr.cmd b/solr/bin/solr.cmd
index 6305c80ead1..a3c9cfc3df6 100644
--- a/solr/bin/solr.cmd
+++ b/solr/bin/solr.cmd
@@ -784,6 +784,8 @@ IF EXIST "!SOLR_LOGS_DIR!\solr_gc.log" (
move /Y "!SOLR_LOGS_DIR!\solr_gc.log" "!SOLR_LOGS_DIR!\solr_gc_log_!now_ts!"
)
+IF NOT "%ZK_HOST%"=="" set SOLR_MODE=solrcloud
+
IF "%SOLR_MODE%"=="solrcloud" (
IF "%ZK_CLIENT_TIMEOUT%"=="" set "ZK_CLIENT_TIMEOUT=15000"