You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by th...@apache.org on 2014/12/01 21:32:26 UTC

svn commit: r1642749 - in /lucene/dev/branches/lucene_solr_4_10/solr: CHANGES.txt bin/solr bin/solr.cmd bin/solr.in.cmd bin/solr.in.sh

Author: thelabdude
Date: Mon Dec  1 20:32:26 2014
New Revision: 1642749

URL: http://svn.apache.org/r1642749
Log:
SOLR-6726: better strategy for selecting the JMX RMI port based on SOLR_PORT in bin/solr

Modified:
    lucene/dev/branches/lucene_solr_4_10/solr/CHANGES.txt
    lucene/dev/branches/lucene_solr_4_10/solr/bin/solr
    lucene/dev/branches/lucene_solr_4_10/solr/bin/solr.cmd
    lucene/dev/branches/lucene_solr_4_10/solr/bin/solr.in.cmd
    lucene/dev/branches/lucene_solr_4_10/solr/bin/solr.in.sh

Modified: lucene/dev/branches/lucene_solr_4_10/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_4_10/solr/CHANGES.txt?rev=1642749&r1=1642748&r2=1642749&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_4_10/solr/CHANGES.txt (original)
+++ lucene/dev/branches/lucene_solr_4_10/solr/CHANGES.txt Mon Dec  1 20:32:26 2014
@@ -66,6 +66,9 @@ Bug Fixes
 * SOLR-6610: Slow startup of new clusters because ZkController.publishAndWaitForDownStates
   always times out. (Jessica Cheng Mallet, shalin, Noble Paul)
 
+* SOLR-6726: better strategy for selecting the JMX RMI port based on SOLR_PORT in bin/solr
+  script (Timothy Potter)
+
 Other Changes
 ----------------------
 

Modified: lucene/dev/branches/lucene_solr_4_10/solr/bin/solr
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_4_10/solr/bin/solr?rev=1642749&r1=1642748&r2=1642749&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_4_10/solr/bin/solr (original)
+++ lucene/dev/branches/lucene_solr_4_10/solr/bin/solr Mon Dec  1 20:32:26 2014
@@ -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 ""
@@ -174,9 +177,9 @@ function print_usage() {
     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 "                  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 ""
@@ -192,10 +195,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]"
@@ -721,8 +720,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
@@ -809,12 +807,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
@@ -858,21 +861,30 @@ 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_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

Modified: lucene/dev/branches/lucene_solr_4_10/solr/bin/solr.cmd
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_4_10/solr/bin/solr.cmd?rev=1642749&r1=1642748&r2=1642749&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_4_10/solr/bin/solr.cmd (original)
+++ lucene/dev/branches/lucene_solr_4_10/solr/bin/solr.cmd Mon Dec  1 20:32:26 2014
@@ -508,12 +508,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 (
@@ -557,12 +558,24 @@ 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_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

Modified: lucene/dev/branches/lucene_solr_4_10/solr/bin/solr.in.cmd
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_4_10/solr/bin/solr.in.cmd?rev=1642749&r1=1642748&r2=1642749&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_4_10/solr/bin/solr.in.cmd (original)
+++ lucene/dev/branches/lucene_solr_4_10/solr/bin/solr.in.cmd Mon Dec  1 20:32:26 2014
@@ -63,3 +63,5 @@ REM JMX savvy tools like VisualVM remote
 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

Modified: lucene/dev/branches/lucene_solr_4_10/solr/bin/solr.in.sh
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_4_10/solr/bin/solr.in.sh?rev=1642749&r1=1642748&r2=1642749&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_4_10/solr/bin/solr.in.sh (original)
+++ lucene/dev/branches/lucene_solr_4_10/solr/bin/solr.in.sh Mon Dec  1 20:32:26 2014
@@ -60,3 +60,6 @@ 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"
+
+# The script will use SOLR_PORT+10000 for the RMI_PORT or you can set it here
+# RMI_PORT=18983