Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-6697: bin/solr start scripts allow setting SOLR_OPTS in solr.in.*

Jan Høydahl5240a5ac8a3c
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 2e5de46014d..23e1cbdde2a 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -385,6 +385,8 @@ Other Changes
* SOLR-6715: ZkSolrResourceLoader constructors accept a parameter called 'collection'
but it should be 'configName'. (shalin)
+* SOLR-6697: bin/solr start scripts allow setting SOLR_OPTS in solr.in.* (janhoy)
+
================== 4.10.3 ==================
Bug Fixes
diff --git a/solr/bin/solr b/solr/bin/solr
index dcea957a9a6..3a268d02c3f 100755
--- a/solr/bin/solr
+++ b/solr/bin/solr
@@ -1014,6 +1014,9 @@ function launch_solr() {
echo -e " CLOUD_MODE_OPTS = $CLOUD_MODE_OPTS"
echo -e " SOLR_TIMEZONE = $SOLR_TIMEZONE"
+ if [ "$SOLR_OPTS" != "" ]; then
+ echo -e " SOLR_OPTS = $SOLR_OPTS"
+ fi
if [ "$SOLR_ADDL_ARGS" != "" ]; then
echo -e " SOLR_ADDL_ARGS = $SOLR_ADDL_ARGS"
fi
@@ -1034,7 +1037,8 @@ $SOLR_HOST_ARG -Djetty.port=$SOLR_PORT \
-Dsolr.solr.home=$SOLR_HOME \
-Dsolr.install.dir=$SOLR_TIP \
-Duser.timezone=$SOLR_TIMEZONE \
--Djava.net.preferIPv4Stack=true"
+-Djava.net.preferIPv4Stack=true \
+$SOLR_OPTS"
if [ "$SOLR_MODE" == "solrcloud" ]; then
IN_CLOUD_MODE=" in SolrCloud mode"
diff --git a/solr/bin/solr.cmd b/solr/bin/solr.cmd
index e35a5bd9bc5..6faf1a1a495 100644
--- a/solr/bin/solr.cmd
+++ b/solr/bin/solr.cmd
@@ -617,6 +617,12 @@ IF "%verbose%"=="1" (
@echo REMOTE_JMX_OPTS = %REMOTE_JMX_OPTS%
@echo CLOUD_MODE_OPTS = %CLOUD_MODE_OPTS%
@echo SOLR_TIMEZONE = %SOLR_TIMEZONE%
+ IF NOT "%SOLR_OPTS%"=="" (
+ @echo SOLR_OPTS = %SOLR_OPTS%
+ )
+ IF NOT "%SOLR_ADDL_ARGS%"=="" (
+ @echo SOLR_ADDL_ARGS = %SOLR_ADDL_ARGS%
+ )
)
set START_OPTS=-Duser.timezone=%SOLR_TIMEZONE% -Djava.net.preferIPv4Stack=true
@@ -625,6 +631,7 @@ IF NOT "!CLOUD_MODE_OPTS!"=="" set START_OPTS=%START_OPTS% !CLOUD_MODE_OPTS!
IF NOT "%REMOTE_JMX_OPTS%"=="" set START_OPTS=%START_OPTS% %REMOTE_JMX_OPTS%
IF NOT "%SOLR_ADDL_ARGS%"=="" set START_OPTS=%START_OPTS% %SOLR_ADDL_ARGS%
IF NOT "%SOLR_HOST_ARG%"=="" set START_OPTS=%START_OPTS% %SOLR_HOST_ARG%
+IF NOT "%SOLR_OPTS%"=="" set START_OPTS=%START_OPTS% %SOLR_OPTS%
cd "%SOLR_SERVER_DIR%"
@echo.
diff --git a/solr/bin/solr.in.cmd b/solr/bin/solr.in.cmd
index 4724b279d75..30530209f71 100644
--- a/solr/bin/solr.in.cmd
+++ b/solr/bin/solr.in.cmd
@@ -67,3 +67,10 @@ REM JMX savvy tools like VisualVM remotely, set to "false" to disable that behav
REM (recommended in production environments)
set ENABLE_REMOTE_JMX_OPTS=true
+REM Anything you add to the SOLR_OPTS variable will be included in the java
+REM start command line as-is, in ADDITION to other options. If you specify the
+REM -a option on start script, those options will be appended as well. Examples:
+REM set SOLR_OPTS=%SOLR_OPTS% -Dsolr.autoSoftCommit.maxTime=3000
+REM set SOLR_OPTS=%SOLR_OPTS% -Dsolr.autoCommit.maxTime=60000
+REM set SOLR_OPTS=%SOLR_OPTS% -Dsolr.clustering.enabled=true
+
diff --git a/solr/bin/solr.in.sh b/solr/bin/solr.in.sh
index 5ca7d32648e..ff7a6da5b79 100644
--- a/solr/bin/solr.in.sh
+++ b/solr/bin/solr.in.sh
@@ -60,3 +60,10 @@ GC_TUNE="-XX:NewRatio=3 \
# JMX savvy tools like VisualVM remotely, set to "false" to disable that behavior
# (recommended in production environments)
ENABLE_REMOTE_JMX_OPTS="true"
+
+# Anything you add to the SOLR_OPTS variable will be included in the java
+# start command line as-is, in ADDITION to other options. If you specify the
+# -a option on start script, those options will be appended as well. Examples:
+#SOLR_OPTS="$SOLR_OPTS -Dsolr.autoSoftCommit.maxTime=3000"
+#SOLR_OPTS="$SOLR_OPTS -Dsolr.autoCommit.maxTime=60000"
+#SOLR_OPTS="$SOLR_OPTS -Dsolr.clustering.enabled=true"