mirror of https://github.com/apache/lucene.git
SOLR-6486: solr start script can have a debug flag option; use -a to set arbitrary options.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1626833 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6efd37464f
commit
5703c00949
|
@ -249,6 +249,9 @@ Other Changes
|
|||
* SOLR-6115: Cleanup enum/string action types in Overseer, OverseerCollectionProcessor and
|
||||
CollectionHandler. (Erick Erickson, shalin)
|
||||
|
||||
* SOLR-6486: solr start script can have a debug flag option; use -a to set arbitrary options
|
||||
(Noble Paul, Timothy Potter)
|
||||
|
||||
================== 4.10.0 =================
|
||||
|
||||
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release
|
||||
|
|
|
@ -117,7 +117,7 @@ function print_usage() {
|
|||
echo ""
|
||||
elif [[ "$CMD" == "start" || "$CMD" == "restart" ]]; then
|
||||
echo ""
|
||||
echo "Usage: solr $CMD [-f] [-c] [-h hostname] [-p port] [-d directory] [-z zkHost] [-m memory] [-e example] [-V]"
|
||||
echo "Usage: solr $CMD [-f] [-c] [-h hostname] [-p port] [-d directory] [-z zkHost] [-m memory] [-e example] [-a \"additional-options\"] [-V]"
|
||||
echo ""
|
||||
echo " -f Start Solr in foreground; default starts Solr in the background"
|
||||
echo " and sends stdout / stderr to solr-PORT-console.log"
|
||||
|
@ -144,13 +144,18 @@ function print_usage() {
|
|||
echo " schemaless: Schema-less example"
|
||||
echo " multicore: Multicore"
|
||||
echo ""
|
||||
echo " -a Additional parameters to pass to the JVM when starting Solr, such as to setup"
|
||||
echo " Java debug options. For example, to enable a Java debugger to attach to the Solr JVM"
|
||||
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 " -noprompt Don't prompt for input; accept all defaults when running examples that accept user input"
|
||||
echo ""
|
||||
echo " -V Verbose messages from this script"
|
||||
echo ""
|
||||
elif [ "$CMD" == "stop" ]; then
|
||||
echo ""
|
||||
echo "Usage: solr stop [-k key] [-p port]"
|
||||
echo "Usage: solr stop [-k key] [-p port] [-V]"
|
||||
echo ""
|
||||
echo " -k <key> Stop key; default is solrrocks"
|
||||
echo ""
|
||||
|
@ -452,6 +457,10 @@ if [ $# -gt 0 ]; then
|
|||
ZK_HOST="$2"
|
||||
shift 2
|
||||
;;
|
||||
-a|-addlopts)
|
||||
ADDITIONAL_CMD_OPTS="$2"
|
||||
shift 2
|
||||
;;
|
||||
-help|-usage)
|
||||
print_usage "$SCRIPT_CMD"
|
||||
exit 0
|
||||
|
@ -815,7 +824,7 @@ $SOLR_HOST_ARG -Djetty.port=$SOLR_PORT \
|
|||
}
|
||||
|
||||
if [ "$EXAMPLE" != "cloud" ]; then
|
||||
launch_solr "$FG" ""
|
||||
launch_solr "$FG" "$ADDITIONAL_CMD_OPTS"
|
||||
else
|
||||
#
|
||||
# SolrCloud example is a bit involved so needs special handling here
|
||||
|
@ -827,7 +836,7 @@ else
|
|||
echo -e "solr start -cloud -d node1 -p $SOLR_PORT \n\n"
|
||||
|
||||
# can't launch this node in the foreground else we can't run anymore commands
|
||||
launch_solr "false" ""
|
||||
launch_solr "false" "$ADDITIONAL_CMD_OPTS"
|
||||
|
||||
zk_port=$[$SOLR_PORT+1000]
|
||||
zk_host=localhost:$zk_port
|
||||
|
|
|
@ -66,7 +66,7 @@ goto parse_healthcheck_args
|
|||
goto include_vars
|
||||
|
||||
:usage
|
||||
IF NOT "%SCRIPT_ERROR%"=="" ECHO %SCRIPT_ERROR%
|
||||
IF NOT "%SCRIPT_ERROR%"=="" ECHO %SCRIPT_ERROR%
|
||||
IF [%FIRST_ARG%]==[] goto script_usage
|
||||
IF "%FIRST_ARG%"=="-help" goto script_usage
|
||||
IF "%FIRST_ARG%"=="-usage" goto script_usage
|
||||
|
@ -81,7 +81,7 @@ goto done
|
|||
@echo Usage: solr COMMAND OPTIONS
|
||||
@echo where COMMAND is one of: start, stop, restart, healthcheck
|
||||
@echo.
|
||||
@echo Example: Start Solr running in the background on port 8984:
|
||||
@echo Example: Start Solr running in the background on port 8984:
|
||||
@echo.
|
||||
@echo ./solr start -p 8984
|
||||
@echo.
|
||||
|
@ -92,7 +92,7 @@ goto done
|
|||
|
||||
:start_usage
|
||||
@echo.
|
||||
@echo Usage: solr %SCRIPT_CMD% [-f] [-c] [-h hostname] [-p port] [-d directory] [-z zkHost] [-m memory] [-e example] [-V]
|
||||
@echo Usage: solr %SCRIPT_CMD% [-f] [-c] [-h hostname] [-p port] [-d directory] [-z zkHost] [-m memory] [-e example] [-a "additional-options"] [-V]
|
||||
@echo.
|
||||
@echo -f Start Solr in foreground; default starts Solr in the background
|
||||
@echo and sends stdout / stderr to solr-PORT-console.log
|
||||
|
@ -119,6 +119,11 @@ goto done
|
|||
@echo schemaless: Schema-less example
|
||||
@echo multicore: Multicore
|
||||
@echo.
|
||||
@echo -a opts Additional parameters to pass to the JVM when starting Solr, such as to setup
|
||||
@echo Java debug options. For example, to enable a Java debugger to attach to the Solr JVM
|
||||
@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 -noprompt Don't prompt for input; accept all defaults when running examples that accept user input
|
||||
@echo.
|
||||
@echo -V Verbose messages from this script
|
||||
|
@ -182,6 +187,8 @@ 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"=="-a" goto set_addl_opts
|
||||
IF "%1"=="-addlopts" goto set_addl_opts
|
||||
IF "%1"=="-noprompt" goto set_noprompt
|
||||
IF NOT "%1"=="" goto invalid_cmd_line
|
||||
process_script_cmd
|
||||
|
@ -208,7 +215,7 @@ goto parse_args
|
|||
|
||||
:set_server_dir
|
||||
|
||||
set "arg=%2"
|
||||
set "arg=%~2"
|
||||
set firstChar=%arg:~0,1%
|
||||
IF "%firstChar%"=="-" (
|
||||
set SCRIPT_ERROR=Expected directory but found %2 instead!
|
||||
|
@ -216,10 +223,10 @@ IF "%firstChar%"=="-" (
|
|||
)
|
||||
|
||||
REM See if they are using a short-hand name relative from the Solr tip directory
|
||||
IF EXIST "%SOLR_TIP%\%2" (
|
||||
set "SOLR_SERVER_DIR=%SOLR_TIP%\%2"
|
||||
IF EXIST "%SOLR_TIP%\%~2" (
|
||||
set "SOLR_SERVER_DIR=%SOLR_TIP%\%~2"
|
||||
) ELSE (
|
||||
set "SOLR_SERVER_DIR=%2"
|
||||
set "SOLR_SERVER_DIR=%~2"
|
||||
)
|
||||
SHIFT
|
||||
SHIFT
|
||||
|
@ -227,69 +234,77 @@ goto parse_args
|
|||
|
||||
:set_example
|
||||
|
||||
set "arg=%2"
|
||||
set "arg=%~2"
|
||||
set firstChar=%arg:~0,1%
|
||||
IF "%firstChar%"=="-" (
|
||||
set SCRIPT_ERROR=Expected example name but found %2 instead!
|
||||
goto invalid_cmd_line
|
||||
)
|
||||
|
||||
set EXAMPLE=%2
|
||||
set EXAMPLE=%~2
|
||||
SHIFT
|
||||
SHIFT
|
||||
goto parse_args
|
||||
|
||||
:set_memory
|
||||
|
||||
set "arg=%2"
|
||||
set "arg=%~2"
|
||||
set firstChar=%arg:~0,1%
|
||||
IF "%firstChar%"=="-" (
|
||||
set SCRIPT_ERROR=Expected memory setting but found %2 instead!
|
||||
goto invalid_cmd_line
|
||||
)
|
||||
|
||||
set SOLR_HEAP=%2
|
||||
set SOLR_HEAP=%~2
|
||||
@echo SOLR_HEAP=%SOLR_HEAP%
|
||||
SHIFT
|
||||
SHIFT
|
||||
goto parse_args
|
||||
|
||||
:set_host
|
||||
set "arg=%2"
|
||||
set "arg=%~2"
|
||||
set firstChar=%arg:~0,1%
|
||||
IF "%firstChar%"=="-" (
|
||||
set SCRIPT_ERROR=Expected hostname but found %2 instead!
|
||||
goto invalid_cmd_line
|
||||
)
|
||||
|
||||
set SOLR_HOST=%2
|
||||
set SOLR_HOST=%~2
|
||||
SHIFT
|
||||
SHIFT
|
||||
goto parse_args
|
||||
|
||||
:set_port
|
||||
set "arg=%2"
|
||||
set "arg=%~2"
|
||||
set firstChar=%arg:~0,1%
|
||||
IF "%firstChar%"=="-" (
|
||||
set SCRIPT_ERROR=Expected port but found %2 instead!
|
||||
goto invalid_cmd_line
|
||||
)
|
||||
|
||||
set SOLR_PORT=%2
|
||||
set SOLR_PORT=%~2
|
||||
SHIFT
|
||||
SHIFT
|
||||
goto parse_args
|
||||
|
||||
:set_zookeeper
|
||||
|
||||
set "arg=%2"
|
||||
set "arg=%~2"
|
||||
set firstChar=%arg:~0,1%
|
||||
IF "%firstChar%"=="-" (
|
||||
set SCRIPT_ERROR=Expected ZooKeeper connection string but found %2 instead!
|
||||
goto invalid_cmd_line
|
||||
)
|
||||
|
||||
set "ZK_HOST=%2"
|
||||
set "ZK_HOST=%~2"
|
||||
SHIFT
|
||||
SHIFT
|
||||
goto parse_args
|
||||
|
||||
:set_addl_opts
|
||||
|
||||
set "arg=%~2"
|
||||
set "SOLR_ADDL_ARGS=%~2"
|
||||
SHIFT
|
||||
SHIFT
|
||||
goto parse_args
|
||||
|
@ -360,7 +375,7 @@ IF "%SOLR_PORT%"=="" set SOLR_PORT=8983
|
|||
IF "%STOP_PORT%"=="" set STOP_PORT=79%SOLR_PORT:~-2,2%
|
||||
|
||||
IF "%SCRIPT_CMD%"=="start" (
|
||||
REM see if Solr is already running using netstat
|
||||
REM see if Solr is already running using netstat
|
||||
For /f "tokens=5" %%j in ('netstat -aon ^| find /i "listening" ^| find ":%SOLR_PORT%"') do (
|
||||
set "SCRIPT_ERROR=Process %%j is already listening on port %SOLR_PORT%. If this is Solr, please stop it first before starting (or use restart). If this is not Solr, then please choose a different port using -p PORT"
|
||||
goto err
|
||||
|
@ -404,7 +419,7 @@ IF "%SOLR_MODE%"=="solrcloud" (
|
|||
IF "%verbose%"=="1" echo Configuring SolrCloud to launch an embedded ZooKeeper using -DzkRun
|
||||
set "CLOUD_MODE_OPTS=!CLOUD_MODE_OPTS! -DzkRun"
|
||||
IF EXIST "%SOLR_HOME%\collection1\core.properties" set "CLOUD_MODE_OPTS=!CLOUD_MODE_OPTS! -Dbootstrap_confdir=./solr/collection1/conf -Dcollection.configName=myconf -DnumShards=1"
|
||||
)
|
||||
)
|
||||
) ELSE (
|
||||
set CLOUD_MODE_OPTS=
|
||||
)
|
||||
|
@ -425,7 +440,7 @@ IF NOT "%SOLR_HOST%"=="" set REMOTE_JMX_OPTS=%REMOTE_JMX_OPTS% -Djava.rmi.server
|
|||
|
||||
IF NOT "%SOLR_HEAP%"=="" set SOLR_JAVA_MEM=-Xms%SOLR_HEAP% -Xmx%SOLR_HEAP%
|
||||
IF "%SOLR_JAVA_MEM%"=="" set SOLR_JAVA_MEM=-Xms512m -Xmx512m
|
||||
IF "%SOLR_TIMEZONE%"=="" set SOLR_TIMEZONE=UTC
|
||||
IF "%SOLR_TIMEZONE%"=="" set SOLR_TIMEZONE=UTC
|
||||
|
||||
IF "%verbose%"=="1" (
|
||||
@echo Starting Solr using the following settings:
|
||||
|
@ -452,7 +467,7 @@ IF NOT "%SOLR_HOST_ARG%"=="" set START_OPTS=%START_OPTS% %SOLR_HOST_ARG%
|
|||
cd "%SOLR_SERVER_DIR%"
|
||||
@echo.
|
||||
@echo Starting Solr on port %SOLR_PORT% from %SOLR_SERVER_DIR%
|
||||
@echo.
|
||||
@echo.
|
||||
IF "%FG%"=="1" (
|
||||
REM run solr in the foreground
|
||||
"%JAVA%" -server -Xss256k %SOLR_JAVA_MEM% %START_OPTS% -DSTOP.PORT=%STOP_PORT% -DSTOP.KEY=%STOP_KEY% ^
|
||||
|
@ -484,14 +499,14 @@ IF "%NO_USER_PROMPT%"=="1" (
|
|||
goto while_num_nodes_not_valid
|
||||
)
|
||||
|
||||
:while_num_nodes_not_valid
|
||||
:while_num_nodes_not_valid
|
||||
IF "%USER_INPUT%"=="" set USER_INPUT=2
|
||||
SET /A INPUT_AS_NUM=!USER_INPUT!*1
|
||||
IF %INPUT_AS_NUM% GEQ 1 IF %INPUT_AS_NUM% LEQ 4 set CLOUD_NUM_NODES=%INPUT_AS_NUM%
|
||||
IF NOT DEFINED CLOUD_NUM_NODES (
|
||||
SET USER_INPUT=
|
||||
SET /P "USER_INPUT=Please enter a number between 1 and 4 [2]: "
|
||||
goto while_num_nodes_not_valid
|
||||
goto while_num_nodes_not_valid
|
||||
)
|
||||
@echo Ok, let's start up %CLOUD_NUM_NODES% Solr nodes for your example SolrCloud cluster.
|
||||
|
||||
|
@ -511,7 +526,7 @@ for /l %%x in (1, 1, !CLOUD_NUM_NODES!) do (
|
|||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
IF "%NO_USER_PROMPT%"=="1" (
|
||||
set NODE_PORT=!DEF_PORT!
|
||||
) ELSE (
|
||||
|
@ -521,20 +536,20 @@ for /l %%x in (1, 1, !CLOUD_NUM_NODES!) do (
|
|||
echo node%%x port: !NODE_PORT!
|
||||
@echo.
|
||||
)
|
||||
|
||||
|
||||
IF NOT EXIST "%SOLR_TIP%\node%%x" (
|
||||
@echo Cloning %DEFAULT_SERVER_DIR% into %SOLR_TIP%\node%%x
|
||||
xcopy /Q /E /I "%DEFAULT_SERVER_DIR%" "%SOLR_TIP%\node%%x"
|
||||
)
|
||||
|
||||
IF %%x EQU 1 (
|
||||
|
||||
IF %%x EQU 1 (
|
||||
set EXAMPLE=
|
||||
START "" "%SDIR%\solr" -f -c -p !NODE_PORT! -d node1
|
||||
set NODE1_PORT=!NODE_PORT!
|
||||
) ELSE (
|
||||
set /A ZK_PORT=!NODE1_PORT!+1000
|
||||
set "ZK_HOST=localhost:!ZK_PORT!"
|
||||
START "" "%SDIR%\solr" -f -c -p !NODE_PORT! -d node%%x -z !ZK_HOST!
|
||||
START "" "%SDIR%\solr" -f -c -p !NODE_PORT! -d node%%x -z !ZK_HOST!
|
||||
)
|
||||
|
||||
timeout /T 10
|
||||
|
@ -600,7 +615,7 @@ echo.
|
|||
set COLLECTIONS_API=http://localhost:!NODE1_PORT!/solr/admin/collections
|
||||
|
||||
set "CLOUD_CREATE_COLLECTION_CMD=%COLLECTIONS_API%?action=CREATE&name=%CLOUD_COLLECTION%&replicationFactor=%CLOUD_REPFACT%&numShards=%CLOUD_NUM_SHARDS%&collection.configName=!CLOUD_CONFIG!&maxShardsPerNode=%MAX_SHARDS_PER_NODE%&wt=json&indent=2"
|
||||
echo Creating new collection %CLOUD_COLLECTION% with %CLOUD_NUM_SHARDS% shards and replication factor %CLOUD_REPFACT% using Collections API command:
|
||||
echo Creating new collection %CLOUD_COLLECTION% with %CLOUD_NUM_SHARDS% shards and replication factor %CLOUD_REPFACT% using Collections API command:
|
||||
echo.
|
||||
@echo "%CLOUD_CREATE_COLLECTION_CMD%"
|
||||
echo.
|
||||
|
@ -620,7 +635,7 @@ goto done
|
|||
|
||||
|
||||
:get_info
|
||||
REM Find all Java processes, correlate with those listening on a port
|
||||
REM Find all Java processes, correlate with those listening on a port
|
||||
REM and then try to contact via that port using the status tool
|
||||
for /f "tokens=2" %%a in ('tasklist ^| find "java.exe"') do (
|
||||
for /f "tokens=2,5" %%j in ('netstat -aon ^| find /i "listening"') do (
|
||||
|
@ -633,11 +648,11 @@ for /f "tokens=2" %%a in ('tasklist ^| find "java.exe"') do (
|
|||
"%JAVA%" -Dlog4j.configuration="file:%DEFAULT_SERVER_DIR%\scripts\cloud-scripts\log4j.properties" ^
|
||||
-classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*" ^
|
||||
org.apache.solr.util.SolrCLI status -solr http://localhost:%%y/solr
|
||||
|
||||
|
||||
@echo.
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
if NOT "!has_info!"=="1" echo No running Solr nodes found.
|
||||
|
@ -656,13 +671,13 @@ IF "%1"=="/?" goto usage
|
|||
goto run_healthcheck
|
||||
|
||||
:set_healthcheck_collection
|
||||
set HEALTHCHECK_COLLECTION=%2
|
||||
set HEALTHCHECK_COLLECTION=%~2
|
||||
SHIFT
|
||||
SHIFT
|
||||
goto parse_healthcheck_args
|
||||
|
||||
:set_healthcheck_zk
|
||||
set HEALTHCHECK_ZK_HOST=%2
|
||||
set HEALTHCHECK_ZK_HOST=%~2
|
||||
SHIFT
|
||||
SHIFT
|
||||
goto parse_healthcheck_args
|
||||
|
|
Loading…
Reference in New Issue