SOLR-7580: Move defaults in bin/solr.in.sh into bin/solr (incl. Windows)

(cherry picked from commit 8ae3304)
This commit is contained in:
David Smiley 2016-10-19 16:38:06 -04:00
parent 0ab908694e
commit 22cee924ac
5 changed files with 113 additions and 91 deletions

View File

@ -36,10 +36,10 @@ Upgrade Notes
----------------------
* If you use the JSON Facet API (json.facet) with method=stream, you must now set sort='index asc' to get the streaming
behavior; otherwise it won't stream. Reminder: "method" is a hint that doesn't change defaults of other parameters.
behavior; otherwise it won't stream. Reminder: "method" is a hint that doesn't change defaults of other parameters.
* If you use the JSON Facet API (json.facet) to facet on a numeric field and if you use mincount=0 or if you set the
prefix, then you will now get an error as these options are incompatible with numeric faceting.
prefix, then you will now get an error as these options are incompatible with numeric faceting.
* Solr's logging verbosity at the INFO level has been greatly reduced, and
you may need to update the log configs to use the DEBUG level to get the
@ -50,6 +50,9 @@ prefix, then you will now get an error as these options are incompatible with nu
addition, MiniSolrCloudCluster#uploadConfigSet(File, String) has been
deprecated in favour of #uploadConfigSet(Path, String)
* The bin/solr.in.sh (bin/solr.in.cmd on Windows) is now completely commented by default. Previously, this wasn't so,
which had the effect of masking existing environment variables.
New Features
----------------------
* SOLR-5725: facet.method=enum can bypass exact counts calculation with facet.exists=true, it just returns 1 for
@ -261,6 +264,9 @@ Other Changes
* SOLR-9634: Deprecate collection methods on MiniSolrCloudCluster (Alan Woodward)
* SOLR-7580: Moved defaults within bin/solr.in.sh (and bin/solr.in.cmd on Windows) to bin/solr (and bin/solr.cmd)
such that the default state of these files is to set nothing. This makes Solr work better with Docker. (David Smiley)
================== 6.2.1 ==================
Bug Fixes

View File

@ -1409,15 +1409,21 @@ if [ "`echo $java_ver_out | grep -i "IBM J9"`" != "" ]; then
JAVA_VENDOR="IBM J9"
fi
# Establish default opts no env var set (otherwise init to empty)
if [ -z ${GC_LOG_OPTS+x} ]; then
GC_LOG_OPTS=('-verbose:gc' '-XX:+PrintHeapAtGC' '-XX:+PrintGCDetails' \
'-XX:+PrintGCDateStamps' '-XX:+PrintGCTimeStamps' '-XX:+PrintTenuringDistribution' \
'-XX:+PrintGCApplicationStoppedTime')
else
GC_LOG_OPTS=($GC_LOG_OPTS)
fi
# if verbose gc logging enabled, setup the location of the log file
if [ "$GC_LOG_OPTS" != "" ]; then
gc_log_flag="-Xloggc"
if [ "$JAVA_VENDOR" == "IBM J9" ]; then
gc_log_flag="-Xverbosegclog"
fi
GC_LOG_OPTS=($GC_LOG_OPTS "$gc_log_flag:$SOLR_LOGS_DIR/solr_gc.log")
else
GC_LOG_OPTS=()
GC_LOG_OPTS+=("$gc_log_flag:$SOLR_LOGS_DIR/solr_gc.log")
fi
# If ZK_HOST is defined, the assume SolrCloud mode
@ -1484,6 +1490,12 @@ else
JAVA_MEM_OPTS=("-Xms$SOLR_HEAP" "-Xmx$SOLR_HEAP")
fi
# Pick default for Java thread stack size, and then add to SOLR_OPTS
if [ -z ${SOLR_JAVA_STACK_SIZE+x} ]; then
SOLR_JAVA_STACK_SIZE='-Xss256k'
fi
SOLR_OPTS+=($SOLR_JAVA_STACK_SIZE)
if [ -z "$SOLR_TIMEZONE" ]; then
SOLR_TIMEZONE='UTC'
fi
@ -1496,20 +1508,28 @@ function launch_solr() {
SOLR_ADDL_ARGS="$2"
GC_TUNE=($GC_TUNE)
# deal with Java version specific GC and other flags
if [ "${JAVA_VERSION:0:3}" == "1.7" ]; then
# Specific Java version hacking
GC_TUNE+=('-XX:CMSFullGCsBeforeCompaction=1' '-XX:CMSTriggerPermRatio=80')
if [ "$JAVA_VENDOR" != "IBM J9" ]; then
JAVA_MINOR_VERSION=${JAVA_VERSION:(-2)}
if [[ $JAVA_MINOR_VERSION -ge 40 && $JAVA_MINOR_VERSION -le 51 ]]; then
GC_TUNE+=('-XX:-UseSuperWord')
echo -e "\nWARNING: Java version $JAVA_VERSION has known bugs with Lucene and requires the -XX:-UseSuperWord flag. Please consider upgrading your JVM.\n"
fi
fi
# define default GC_TUNE
if [ -z ${GC_TUNE+x} ]; then
GC_TUNE=('-XX:NewRatio=3' \
'-XX:SurvivorRatio=4' \
'-XX:TargetSurvivorRatio=90' \
'-XX:MaxTenuringThreshold=8' \
'-XX:+UseConcMarkSweepGC' \
'-XX:+UseParNewGC' \
'-XX:ConcGCThreads=4' '-XX:ParallelGCThreads=4' \
'-XX:+CMSScavengeBeforeRemark' \
'-XX:PretenureSizeThreshold=64m' \
'-XX:+UseCMSInitiatingOccupancyOnly' \
'-XX:CMSInitiatingOccupancyFraction=50' \
'-XX:CMSMaxAbortablePrecleanTime=6000' \
'-XX:+CMSParallelRemarkEnabled' \
'-XX:+ParallelRefProcEnabled' \
'-XX:-OmitStackTraceInFastThrow')
else
GC_TUNE=($GC_TUNE)
fi
# If SSL-related system props are set, add them to SOLR_OPTS
if [ -n "$SOLR_SSL_OPTS" ]; then
# If using SSL and solr.jetty.https.port not set explicitly, use the jetty.port
@ -1540,11 +1560,11 @@ function launch_solr() {
fi
if [ "$SOLR_OPTS" != "" ]; then
echo -e " SOLR_OPTS = ${SOLR_OPTS[@]}"
echo -e " SOLR_OPTS = ${SOLR_OPTS[@]}"
fi
if [ "$SOLR_ADDL_ARGS" != "" ]; then
echo -e " SOLR_ADDL_ARGS = $SOLR_ADDL_ARGS"
echo -e " SOLR_ADDL_ARGS = $SOLR_ADDL_ARGS"
fi
if [ "$ENABLE_REMOTE_JMX_OPTS" == "true" ]; then

View File

@ -62,6 +62,9 @@ IF NOT "%SOLR_HOST%"=="" (
) ELSE (
set "SOLR_TOOL_HOST=localhost"
)
IF "%SOLR_JETTY_HOST%"=="" (
set SOLR_JETTY_HOST=0.0.0.0
)
REM Verify Java is available
IF DEFINED SOLR_JAVA_HOME set "JAVA_HOME=%SOLR_JAVA_HOME%"
@ -910,16 +913,36 @@ IF "%ENABLE_REMOTE_JMX_OPTS%"=="true" (
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_JAVA_STACK_SIZE%"=="" set SOLR_JAVA_STACK_SIZE=-Xss256k
set SOLR_OPTS=%SOLR_JAVA_STACK_SIZE% %SOLR_OPTS%
IF "%SOLR_TIMEZONE%"=="" set SOLR_TIMEZONE=UTC
IF "!JAVA_MAJOR_VERSION!"=="7" (
set "GC_TUNE=%GC_TUNE% -XX:CMSFullGCsBeforeCompaction=1 -XX:CMSTriggerPermRatio=80"
IF !JAVA_BUILD! GEQ 40 (
IF !JAVA_BUILD! LEQ 51 (
set "GC_TUNE=!GC_TUNE! -XX:-UseSuperWord"
@echo WARNING: Java version !JAVA_VERSION_INFO! has known bugs with Lucene and requires the -XX:-UseSuperWord flag. Please consider upgrading your JVM.
)
)
IF "%GC_TUNE%"=="" (
set GC_TUNE=-XX:NewRatio=3 ^
-XX:SurvivorRatio=4 ^
-XX:TargetSurvivorRatio=90 ^
-XX:MaxTenuringThreshold=8 ^
-XX:+UseConcMarkSweepGC ^
-XX:+UseParNewGC ^
-XX:ConcGCThreads=4 -XX:ParallelGCThreads=4 ^
-XX:+CMSScavengeBeforeRemark ^
-XX:PretenureSizeThreshold=64m ^
-XX:+UseCMSInitiatingOccupancyOnly ^
-XX:CMSInitiatingOccupancyFraction=50 ^
-XX:CMSMaxAbortablePrecleanTime=6000 ^
-XX:+CMSParallelRemarkEnabled ^
-XX:+ParallelRefProcEnabled ^
-XX:-OmitStackTraceInFastThrow
)
IF "%GC_LOG_OPTS%"=="" (
set GC_LOG_OPTS=-verbose:gc ^
-XX:+PrintHeapAtGC ^
-XX:+PrintGCDetails ^
-XX:+PrintGCDateStamps ^
-XX:+PrintGCTimeStamps ^
-XX:+PrintTenuringDistribution ^
-XX:+PrintGCApplicationStoppedTime
)
IF "%verbose%"=="1" (
@ -1009,15 +1032,17 @@ IF "%FG%"=="1" (
echo %SOLR_PORT%>"%SOLR_TIP%"\bin\solr-%SOLR_PORT%.port
"%JAVA%" %SERVEROPT% %SOLR_JAVA_MEM% %START_OPTS% %GCLOG_OPT%:"!SOLR_LOGS_DIR!/solr_gc.log" ^
-Dlog4j.configuration="%LOG4J_CONFIG%" -DSTOP.PORT=!STOP_PORT! -DSTOP.KEY=%STOP_KEY% ^
-Djetty.port=%SOLR_PORT% -Dsolr.solr.home="%SOLR_HOME%" -Dsolr.install.dir="%SOLR_TIP%" ^
-Djetty.home="%SOLR_SERVER_DIR%" -Djava.io.tmpdir="%SOLR_SERVER_DIR%\tmp" -jar start.jar "%SOLR_JETTY_CONFIG%"
-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%"
) ELSE (
START /B "Solr-%SOLR_PORT%" /D "%SOLR_SERVER_DIR%" "%JAVA%" %SERVEROPT% %SOLR_JAVA_MEM% %START_OPTS% ^
%GCLOG_OPT%:"!SOLR_LOGS_DIR!/solr_gc.log" -Dlog4j.configuration="%LOG4J_CONFIG%" -DSTOP.PORT=!STOP_PORT! ^
START /B "Solr-%SOLR_PORT%" /D "%SOLR_SERVER_DIR%" ^
"%JAVA%" %SERVEROPT% %SOLR_JAVA_MEM% %START_OPTS% %GCLOG_OPT%:"!SOLR_LOGS_DIR!/solr_gc.log" ^
-Dlog4j.configuration="%LOG4J_CONFIG%" -DSTOP.PORT=!STOP_PORT! -DSTOP.KEY=%STOP_KEY% ^
-Dsolr.log.muteconsole ^
-DSTOP.KEY=%STOP_KEY% -Djetty.port=%SOLR_PORT% -Dsolr.solr.home="%SOLR_HOME%" -Dsolr.install.dir="%SOLR_TIP%" ^
-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"
-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"
echo %SOLR_PORT%>"%SOLR_TIP%"\bin\solr-%SOLR_PORT%.port
REM now wait to see Solr come online ...

View File

@ -16,40 +16,23 @@
@echo off
REM Settings here will override settings in existing env vars or in bin/solr. The default shipped state
REM of this file is completely commented.
REM By default the script will use JAVA_HOME to determine which java
REM to use, but you can set a specific path for Solr to use without
REM affecting other Java applications on your server/workstation.
REM set SOLR_JAVA_HOME=
REM Increase Java Min/Max Heap as needed to support your indexing / query needs
set SOLR_JAVA_MEM=-Xms512m -Xmx512m
REM set SOLR_JAVA_MEM=-Xms512m -Xmx512m
REM Enable verbose GC logging
set GC_LOG_OPTS=-verbose:gc -XX:+PrintHeapAtGC -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime
REM set GC_LOG_OPTS=-verbose:gc -XX:+PrintHeapAtGC -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime
REM Changes the logging level. Valid values: ALL, TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF. Default is INFO
REM This is an alternative to changing the rootLogger in log4j.properties
REM set SOLR_LOG_LEVEL=INFO
REM Location where Solr should write logs to. Absolute or relative to solr start dir
REM set SOLR_LOGS_DIR=logs
REM These GC settings have shown to work well for a number of common Solr workloads
set GC_TUNE=-XX:NewRatio=3 ^
-XX:SurvivorRatio=4 ^
-XX:TargetSurvivorRatio=90 ^
-XX:MaxTenuringThreshold=8 ^
-XX:+UseConcMarkSweepGC ^
-XX:+UseParNewGC ^
-XX:ConcGCThreads=4 -XX:ParallelGCThreads=4 ^
-XX:+CMSScavengeBeforeRemark ^
-XX:PretenureSizeThreshold=64m ^
-XX:+UseCMSInitiatingOccupancyOnly ^
-XX:CMSInitiatingOccupancyFraction=50 ^
-XX:CMSMaxAbortablePrecleanTime=6000 ^
-XX:+CMSParallelRemarkEnabled ^
-XX:+ParallelRefProcEnabled ^
-XX:-OmitStackTraceInFastThrow
REM Various GC settings have shown to work well for a number of common Solr workloads.
REM See solr.cmd GC_TUNE for the default list.
REM set GC_TUNE=-XX:NewRatio=3 -XX:SurvivorRatio=4 etc.
REM Set the ZooKeeper connection string if using an external ZooKeeper ensemble
REM e.g. host1:2181,host2:2181/chroot
@ -69,20 +52,11 @@ REM set SOLR_TIMEZONE=UTC
REM Set to true to activate the JMX RMI connector to allow remote JMX client applications
REM to monitor the JVM hosting Solr; set to "false" to disable that behavior
REM (false is recommended in production environments)
set ENABLE_REMOTE_JMX_OPTS=false
REM set ENABLE_REMOTE_JMX_OPTS=false
REM The script will use SOLR_PORT+10000 for the RMI_PORT or you can set it here
REM set RMI_PORT=18983
REM Set the host interface to listen on. Jetty will listen on all interfaces (0.0.0.0) by default.
REM This must be an IPv4 ("a.b.c.d") or bracketed IPv6 ("[x::y]") address, not a hostname!
set SOLR_JETTY_HOST=0.0.0.0
set SOLR_OPTS=%SOLR_OPTS% -Djetty.host=%SOLR_JETTY_HOST%
REM Set the thread stack size
set SOLR_OPTS=%SOLR_OPTS% -Xss256k
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:
@ -94,6 +68,17 @@ REM Path to a directory for Solr to store cores and their data. By default, Solr
REM If solr.xml is not stored in ZooKeeper, this directory needs to contain solr.xml
REM set SOLR_HOME=
REM Changes the logging level. Valid values: ALL, TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF. Default is INFO
REM This is an alternative to changing the rootLogger in log4j.properties
REM set SOLR_LOG_LEVEL=INFO
REM Location where Solr should write logs to. Absolute or relative to solr start dir
REM set SOLR_LOGS_DIR=logs
REM Set the host interface to listen on. Jetty will listen on all interfaces (0.0.0.0) by default.
REM This must be an IPv4 ("a.b.c.d") or bracketed IPv6 ("[x::y]") address, not a hostname!
REM set SOLR_JETTY_HOST=0.0.0.0
REM Sets the port Solr binds to, default is 8983
REM set SOLR_PORT=8983

View File

@ -13,38 +13,27 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# Settings here will override settings in existing env vars or in bin/solr. The default shipped state
# of this file is completely commented.
# By default the script will use JAVA_HOME to determine which java
# to use, but you can set a specific path for Solr to use without
# affecting other Java applications on your server/workstation.
#SOLR_JAVA_HOME=""
# Increase Java Heap as needed to support your indexing / query needs
SOLR_HEAP="512m"
#SOLR_HEAP="512m"
# Expert: If you want finer control over memory options, specify them directly
# Comment out SOLR_HEAP if you are using this though, that takes precedence
#SOLR_JAVA_MEM="-Xms512m -Xmx512m"
# Enable verbose GC logging
GC_LOG_OPTS="-verbose:gc -XX:+PrintHeapAtGC -XX:+PrintGCDetails \
-XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime"
#GC_LOG_OPTS="-verbose:gc -XX:+PrintHeapAtGC -XX:+PrintGCDetails \
#-XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime"
# These GC settings have shown to work well for a number of common Solr workloads
GC_TUNE="-XX:NewRatio=3 \
-XX:SurvivorRatio=4 \
-XX:TargetSurvivorRatio=90 \
-XX:MaxTenuringThreshold=8 \
-XX:+UseConcMarkSweepGC \
-XX:+UseParNewGC \
-XX:ConcGCThreads=4 -XX:ParallelGCThreads=4 \
-XX:+CMSScavengeBeforeRemark \
-XX:PretenureSizeThreshold=64m \
-XX:+UseCMSInitiatingOccupancyOnly \
-XX:CMSInitiatingOccupancyFraction=50 \
-XX:CMSMaxAbortablePrecleanTime=6000 \
-XX:+CMSParallelRemarkEnabled \
-XX:+ParallelRefProcEnabled \
-XX:-OmitStackTraceInFastThrow"
#GC_TUNE="-XX:NewRatio=3 -XX:SurvivorRatio=4 etc.
# Set the ZooKeeper connection string if using an external ZooKeeper ensemble
# e.g. host1:2181,host2:2181/chroot
@ -64,14 +53,11 @@ GC_TUNE="-XX:NewRatio=3 \
# Set to true to activate the JMX RMI connector to allow remote JMX client applications
# to monitor the JVM hosting Solr; set to "false" to disable that behavior
# (false is recommended in production environments)
ENABLE_REMOTE_JMX_OPTS="false"
#ENABLE_REMOTE_JMX_OPTS="false"
# The script will use SOLR_PORT+10000 for the RMI_PORT or you can set it here
# RMI_PORT=18983
# Set the thread stack size
SOLR_OPTS="$SOLR_OPTS -Xss256k"
# 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: