SOLR-6726: better strategy for selecting the JMX RMI port based on SOLR_PORT in bin/solr

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1642745 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Timothy Potter 2014-12-01 19:50:30 +00:00
parent 3c34c0f125
commit 9806b86719
5 changed files with 71 additions and 34 deletions

View File

@ -286,13 +286,6 @@ Bug Fixes
it caused long startup times on lage indexes even when it wasn't used.
(yonik)
* SOLR-6662: better validation when parsing command-line options that expect a value
(Timothy Potter)
* SOLR-6705: Better strategy for dealing with JVM specific options in the start
scripts; remove -XX:+AggressiveOpts and only set -XX:-UseSuperWord for Java 1.7u40
to u51. (Uwe Schindler, janhoy, hossman, Timothy Potter)
* SOLR-6738: Admin UI - Escape Data on Plugins-View (steffkes)
* SOLR-3774: Solr adds RequestHandler SolrInfoMBeans twice to the JMX server.
@ -401,10 +394,6 @@ Other Changes
* SOLR-6651: Fix wrong timeout logged in waitForReplicasToComeUp. (shalin)
* SOLR-6661: Adjust all example configurations to allow overriding error-prone
relative paths for solrconfig.xml <lib> references with solr.install.dir
system property; bin/solr scripts will set it appropriately. (ehatcher)
* SOLR-6698: Solr is not consistent wrt ZkCredentialsProvider / ZkCredentialProvider.
References to zkCredentialProvider in System properties or configurations should be
changed to zkCredentialsProvider. (Gregory Chanan)
@ -500,6 +489,26 @@ Bug Fixes
* SOLR-6610: Slow startup of new clusters because ZkController.publishAndWaitForDownStates
always times out. (Jessica Cheng Mallet, shalin, Noble Paul)
* SOLR-6662: better validation when parsing command-line options that expect a value
(Timothy Potter)
* SOLR-6732: Fix handling of leader-initiated recovery state was String in older versions
and is now a JSON map, caused backwards compatibility issues when doing rolling upgrades of
a live cluster while indexing (Timothy Potter)
* SOLR-6705: Better strategy for dealing with JVM specific options in the start
scripts; remove -XX:+AggressiveOpts and only set -XX:-UseSuperWord for Java 1.7u40
to u51. (Uwe Schindler, janhoy, hossman, Timothy Potter)
* SOLR-6726: better strategy for selecting the JMX RMI port based on SOLR_PORT in bin/solr
script (Timothy Potter)
Other Changes
----------------------
* SOLR-6661: Adjust all example configurations to allow overriding error-prone
relative paths for solrconfig.xml <lib> references with solr.install.dir
system property; bin/solr scripts will set it appropriately. (ehatcher)
================== 4.10.2 ==================

View File

@ -150,6 +150,9 @@ function print_usage() {
echo " -h <host> Specify the hostname for this Solr instance"
echo ""
echo " -p <port> Specify the port to start the Solr HTTP listener on; default is 8983"
echo " The specified port (SOLR_PORT) will also be used to determine the stop port"
echo " STOP_PORT=(\$SOLR_PORT-1000) and JMX RMI listen port RMI_PORT=(1\$SOLR_PORT). "
echo " For instance, if you set -p 8985, then the STOP_PORT=7985 and RMI_PORT=18985"
echo ""
echo " -d <dir> Specify the Solr server directory; defaults to server"
echo ""
@ -173,9 +176,9 @@ function print_usage() {
echo " schemaless: Schema-less example"
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 " 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 ""
@ -191,10 +194,6 @@ function print_usage() {
echo ""
echo " -all Find and stop all running Solr servers on this host"
echo ""
echo " -V Verbose messages from this script"
echo ""
echo "NOTE: If port is not specified, then all running Solr servers are stopped."
echo ""
elif [ "$CMD" == "healthcheck" ]; then
echo ""
echo "Usage: solr healthcheck [-c collection] [-z zkHost]"
@ -876,8 +875,7 @@ if [[ "$SCRIPT_CMD" == "start" ]]; then
fi
if [ "$SOLR_PID" != "" ]; then
echo -e "\nSolr already running on port $SOLR_PORT (pid: $SOLR_PID)!"
echo -e "Please use the 'restart' command if you want to restart this node.\n"
echo -e "\nPort $SOLR_PORT is already being used by another process (pid: $SOLR_PID)\n"
exit
fi
else
@ -964,12 +962,17 @@ fi
# These are useful for attaching remove profilers like VisualVM/JConsole
if [ "$ENABLE_REMOTE_JMX_OPTS" == "true" ]; then
if [ "$RMI_PORT" == "" ]; then
RMI_PORT=1$SOLR_PORT
fi
REMOTE_JMX_OPTS="-Dcom.sun.management.jmxremote \
-Dcom.sun.management.jmxremote.local.only=false \
-Dcom.sun.management.jmxremote.ssl=false \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.port=10${SOLR_PORT: -2} \
-Dcom.sun.management.jmxremote.rmi.port=10${SOLR_PORT: -2}"
-Dcom.sun.management.jmxremote.port=$RMI_PORT \
-Dcom.sun.management.jmxremote.rmi.port=$RMI_PORT"
# if the host is set, then set that as the rmi server hostname
if [ "$SOLR_HOST" != "" ]; then
@ -1013,24 +1016,34 @@ function launch_solr() {
if $verbose ; then
echo -e "\nStarting Solr using the following settings:"
echo -e " JAVA = $JAVA"
echo -e " SOLR_SERVER_DIR = $SOLR_SERVER_DIR"
echo -e " SOLR_HOME = $SOLR_HOME"
echo -e " JAVA = $JAVA"
echo -e " SOLR_HOST = $SOLR_HOST"
echo -e " SOLR_PORT = $SOLR_PORT"
echo -e " STOP_PORT = $STOP_PORT"
echo -e " SOLR_JAVA_MEM = $SOLR_JAVA_MEM"
echo -e " GC_TUNE = $GC_TUNE"
echo -e " GC_LOG_OPTS = $GC_LOG_OPTS"
echo -e " SOLR_JAVA_MEM = $SOLR_JAVA_MEM"
echo -e " REMOTE_JMX_OPTS = $REMOTE_JMX_OPTS"
echo -e " CLOUD_MODE_OPTS = $CLOUD_MODE_OPTS"
echo -e " SOLR_TIMEZONE = $SOLR_TIMEZONE"
if [ "$SOLR_MODE" == "solrcloud" ]; then
echo -e " CLOUD_MODE_OPTS = $CLOUD_MODE_OPTS"
fi
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
if [ "$ENABLE_REMOTE_JMX_OPTS" == "true" ]; then
echo -e " RMI_PORT = $RMI_PORT"
echo -e " REMOTE_JMX_OPTS = $REMOTE_JMX_OPTS"
fi
echo -e "\n"
fi
# need to launch solr from the server dir

View File

@ -172,8 +172,6 @@ goto done
@echo.
@echo -all Find and stop all running Solr servers on this host
@echo.
@echo -V Verbose messages from this script
@echo.
goto done
:healthcheck_usage
@ -587,12 +585,13 @@ IF "%SOLR_MODE%"=="solrcloud" (
REM These are useful for attaching remove profilers like VisualVM/JConsole
IF "%ENABLE_REMOTE_JMX_OPTS%"=="true" (
IF "!RMI_PORT!"=="" set RMI_PORT=1%SOLR_PORT%
set REMOTE_JMX_OPTS=-Dcom.sun.management.jmxremote ^
-Dcom.sun.management.jmxremote.local.only=false ^
-Dcom.sun.management.jmxremote.ssl=false ^
-Dcom.sun.management.jmxremote.authenticate=false ^
-Dcom.sun.management.jmxremote.port=10%SOLR_PORT:~-2,2% ^
-Dcom.sun.management.jmxremote.rmi.port=10%SOLR_PORT:~-2,2%
-Dcom.sun.management.jmxremote.port=!RMI_PORT! ^
-Dcom.sun.management.jmxremote.rmi.port=!RMI_PORT!
IF NOT "%SOLR_HOST%"=="" set REMOTE_JMX_OPTS=%REMOTE_JMX_OPTS% -Djava.rmi.server.hostname=%SOLR_HOST%
) ELSE (
@ -636,18 +635,28 @@ IF "%verbose%"=="1" (
@echo SOLR_HOME = %SOLR_HOME%
@echo SOLR_HOST = %SOLR_HOST%
@echo SOLR_PORT = %SOLR_PORT%
@echo STOP_PORT = %STOP_PORT%
@echo SOLR_JAVA_MEM = %SOLR_JAVA_MEM%
@echo GC_TUNE = !GC_TUNE!
@echo GC_LOG_OPTS = %GC_LOG_OPTS%
@echo SOLR_JAVA_MEM = %SOLR_JAVA_MEM%
@echo REMOTE_JMX_OPTS = %REMOTE_JMX_OPTS%
@echo CLOUD_MODE_OPTS = %CLOUD_MODE_OPTS%
@echo SOLR_TIMEZONE = %SOLR_TIMEZONE%
IF "%SOLR_MODE%"=="solrcloud" (
@echo CLOUD_MODE_OPTS = %CLOUD_MODE_OPTS%
)
IF NOT "%SOLR_OPTS%"=="" (
@echo SOLR_OPTS = %SOLR_OPTS%
)
IF NOT "%SOLR_ADDL_ARGS%"=="" (
@echo SOLR_ADDL_ARGS = %SOLR_ADDL_ARGS%
)
IF "%ENABLE_REMOTE_JMX_OPTS%"=="true" (
@echo RMI_PORT = !RMI_PORT!
@echo REMOTE_JMX_OPTS = %REMOTE_JMX_OPTS%
)
)
set START_OPTS=-Duser.timezone=%SOLR_TIMEZONE% -Djava.net.preferIPv4Stack=true

View File

@ -63,6 +63,9 @@ 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 The script will use SOLR_PORT+10000 for the RMI_PORT or you can set it here
REM set RMI_PORT=18983
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:

View File

@ -61,6 +61,9 @@ GC_TUNE="-XX:NewRatio=3 \
# (recommended in production environments)
ENABLE_REMOTE_JMX_OPTS="true"
# The script will use SOLR_PORT+10000 for the RMI_PORT or you can set it here
# RMI_PORT=18983
# 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: