SOLR-9910: Add solr/solr.cmd parameter to append jetty parameters to the start script.

This commit is contained in:
Mark Miller 2017-06-13 15:55:51 -04:00
parent 061a768d87
commit 9a0d9e83f6
3 changed files with 37 additions and 5 deletions

View File

@ -343,6 +343,9 @@ New Features
* SOLR-10660: Add reverse Stream Evaluator (Joel Bernstein)
* SOLR-9910: Add solr/solr.cmd parameter to append jetty parameters to the start script.
(Mano Kovacs via Mark Miller)
Bug Fixes
----------------------
* SOLR-10723 JSON Facet API: resize() implemented incorrectly for CountSlotAcc, HllAgg.NumericAcc

View File

@ -340,6 +340,11 @@ function print_usage() {
echo " you could pass: -a \"-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=18983\""
echo " In most cases, you should wrap the additional parameters in double quotes."
echo ""
echo " -j Additional parameters to pass to Jetty when starting Solr."
echo " For example, to add configuration folder that jetty should read"
echo " you could pass: -j \"--include-jetty-dir=/etc/jetty/custom/server/\""
echo " In most cases, you should wrap the additional parameters in double quotes."
echo ""
echo " -noprompt Don't prompt for input; accept all defaults when running examples that accept user input"
echo ""
echo " -v and -q Verbose (-v) or quiet (-q) logging. Sets default log level to DEBUG or WARN instead of INFO"
@ -1437,6 +1442,11 @@ if [ $# -gt 0 ]; then
PASS_TO_RUN_EXAMPLE+=" -a \"$ADDITIONAL_CMD_OPTS\""
shift 2
;;
-j|-jettyconfig)
ADDITIONAL_JETTY_CONFIG="$2"
PASS_TO_RUN_EXAMPLE+=" -j \"$ADDITIONAL_JETTY_CONFIG\""
shift 2
;;
-k|-key)
STOP_KEY="$2"
shift 2
@ -1803,6 +1813,7 @@ function launch_solr() {
stop_port="$STOP_PORT"
SOLR_ADDL_ARGS="$2"
SOLR_JETTY_ADDL_CONFIG="$3"
# define default GC_TUNE
if [ -z ${GC_TUNE+x} ]; then
@ -1911,12 +1922,12 @@ function launch_solr() {
esac
if [ "$run_in_foreground" == "true" ]; then
exec "$JAVA" "${SOLR_START_OPTS[@]}" $SOLR_ADDL_ARGS -jar start.jar "${SOLR_JETTY_CONFIG[@]}"
exec "$JAVA" "${SOLR_START_OPTS[@]}" $SOLR_ADDL_ARGS -jar start.jar "${SOLR_JETTY_CONFIG[@]}" $SOLR_JETTY_ADDL_CONFIG
else
# run Solr in the background
nohup "$JAVA" "${SOLR_START_OPTS[@]}" $SOLR_ADDL_ARGS -Dsolr.log.muteconsole \
"-XX:OnOutOfMemoryError=$SOLR_TIP/bin/oom_solr.sh $SOLR_PORT $SOLR_LOGS_DIR" \
-jar start.jar "${SOLR_JETTY_CONFIG[@]}" \
-jar start.jar "${SOLR_JETTY_CONFIG[@]}" $SOLR_JETTY_ADDL_CONFIG \
1>"$SOLR_LOGS_DIR/solr-$SOLR_PORT-console.log" 2>&1 & echo $! > "$SOLR_PID_DIR/solr-$SOLR_PORT.pid"
# check if /proc/sys/kernel/random/entropy_avail exists then check output of cat /proc/sys/kernel/random/entropy_avail to see if less than 300
@ -1960,6 +1971,6 @@ function launch_solr() {
fi
}
launch_solr "$FG" "$ADDITIONAL_CMD_OPTS"
launch_solr "$FG" "$ADDITIONAL_CMD_OPTS" "$ADDITIONAL_JETTY_CONFIG"
exit $?

View File

@ -323,6 +323,11 @@ goto done
@echo you could pass: -a "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=18983"
@echo In most cases, you should wrap the additional parameters in double quotes.
@echo.
@echo -j opts Additional parameters to pass to Jetty when starting Solr.
@echo For example, to add configuration folder that jetty should read
@echo you could pass: -j "--include-jetty-dir=/etc/jetty/custom/server/"
@echo In most cases, you should wrap the additional parameters in double quotes.
@echo.
@echo -noprompt Don't prompt for input; accept all defaults when running examples that accept user input
@echo.
@echo -v and -q Verbose (-v) or quiet (-q) logging. Sets default log level to DEBUG or WARN instead of INFO
@ -610,6 +615,8 @@ IF "%1"=="-z" 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
IF "%1"=="-jettyconfig" goto set_addl_jetty_config
IF "%1"=="-noprompt" goto set_noprompt
IF "%1"=="-k" goto set_stop_key
IF "%1"=="-key" goto set_stop_key
@ -816,6 +823,13 @@ SHIFT
SHIFT
goto parse_args
:set_addl_jetty_config
set "arg=%~2"
set "SOLR_JETTY_ADDL_CONFIG=%~2"
SHIFT
SHIFT
goto parse_args
:set_passthru
set "PASSTHRU=%~1=%~2"
IF NOT "%SOLR_OPTS%"=="" (
@ -1112,6 +1126,10 @@ IF "%verbose%"=="1" (
CALL :safe_echo " SOLR_ADDL_ARGS = %SOLR_ADDL_ARGS%"
)
IF NOT "%SOLR_JETTY_ADDL_CONFIG%"=="" (
CALL :safe_echo " SOLR_JETTY_ADDL_CONFIG = %SOLR_JETTY_ADDL_CONFIG%"
)
IF "%ENABLE_REMOTE_JMX_OPTS%"=="true" (
@echo RMI_PORT = !RMI_PORT!
@echo REMOTE_JMX_OPTS = %REMOTE_JMX_OPTS%
@ -1176,7 +1194,7 @@ IF "%FG%"=="1" (
-Dlog4j.configuration="%LOG4J_CONFIG%" -DSTOP.PORT=!STOP_PORT! -DSTOP.KEY=%STOP_KEY% ^
-Dsolr.solr.home="%SOLR_HOME%" -Dsolr.install.dir="%SOLR_TIP%" ^
-Djetty.host=%SOLR_JETTY_HOST% -Djetty.port=%SOLR_PORT% -Djetty.home="%SOLR_SERVER_DIR%" ^
-Djava.io.tmpdir="%SOLR_SERVER_DIR%\tmp" -jar start.jar "%SOLR_JETTY_CONFIG%"
-Djava.io.tmpdir="%SOLR_SERVER_DIR%\tmp" -jar start.jar "%SOLR_JETTY_CONFIG%" "%SOLR_JETTY_ADDL_CONFIG%"
) ELSE (
START /B "Solr-%SOLR_PORT%" /D "%SOLR_SERVER_DIR%" ^
"%JAVA%" %SERVEROPT% %SOLR_JAVA_MEM% %START_OPTS% %GCLOG_OPT% ^
@ -1184,7 +1202,7 @@ IF "%FG%"=="1" (
-Dsolr.log.muteconsole ^
-Dsolr.solr.home="%SOLR_HOME%" -Dsolr.install.dir="%SOLR_TIP%" ^
-Djetty.host=%SOLR_JETTY_HOST% -Djetty.port=%SOLR_PORT% -Djetty.home="%SOLR_SERVER_DIR%" ^
-Djava.io.tmpdir="%SOLR_SERVER_DIR%\tmp" -jar start.jar "%SOLR_JETTY_CONFIG%" > "!SOLR_LOGS_DIR!\solr-%SOLR_PORT%-console.log"
-Djava.io.tmpdir="%SOLR_SERVER_DIR%\tmp" -jar start.jar "%SOLR_JETTY_CONFIG%" "%SOLR_JETTY_ADDL_CONFIG%" > "!SOLR_LOGS_DIR!\solr-%SOLR_PORT%-console.log"
echo %SOLR_PORT%>"%SOLR_TIP%"\bin\solr-%SOLR_PORT%.port
REM now wait to see Solr come online ...