SOLR-11703: Solr Should Send Log Notifications if Ulimits are too low

This commit is contained in:
Erick Erickson 2017-12-25 13:22:19 -08:00
parent 7e321d70df
commit e82e029406
3 changed files with 47 additions and 0 deletions

View File

@ -81,6 +81,8 @@ Other Changes
* SOLR-11701: Upgrade to Tika 1.17 when available (Tim Allison, Karthik Ramachandran via Erick Erickson)
* SOLR-11703: Solr Should Send Log Notifications if Ulimits are too low (Kevin Cowan via Erick Eickson)
================== 7.2.0 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.

View File

@ -1414,6 +1414,40 @@ if [ "$SCRIPT_CMD" != "stop" ] && [ "$SCRIPT_CMD" != "start" ] && [ "$SCRIPT_CMD
exit 1
fi
#Check current Ulimits for Open Files and Max Processes. Warn if they are below the recommended values.
if [ -z "$SOLR_RECOMMENDED_MAX_PROCESSES" ]; then
SOLR_RECOMMENDED_MAX_PROCESSES=65000
fi
if [ -z "$SOLR_RECOMMENDED_OPEN_FILES" ]; then
SOLR_RECOMMENDED_OPEN_FILES=65000
fi
if [ -z "$SOLR_ULIMIT_CHECKS" ] || [ "$SOLR_ULIMIT_CHECKS" != "false" ]; then
if [ "$SCRIPT_CMD" == "start" ] || [ "$SCRIPT_CMD" == "restart" ] || [ "$SCRIPT_CMD" == "status" ]; then
if hash ulimit 2>/dev/null; then
openFiles=$(ulimit -n)
maxProcs=$(ulimit -u)
if [ $openFiles -lt "$SOLR_RECOMMENDED_OPEN_FILES" ]; then
echo "*** [WARN] *** Your open file limit is currently $openFiles. "
echo " It should be set to $SOLR_RECOMMENDED_OPEN_FILES to avoid operational impariment. "
echo " If you no longer wish to see this warning, set SOLR_ULIMIT_CHECKS to false in your profile or solr.in.sh"
fi
if [ $maxProcs -lt "$SOLR_RECOMMENDED_MAX_PROCESSES" ]; then
echo "*** [WARN] *** Your Max Processes Limit is currently $maxProcs. "
echo " It should be set to $SOLR_RECOMMENDED_MAX_PROCESSES to avoid operational impariment. "
echo " If you no longer wish to see this warning, set SOLR_ULIMIT_CHECKS to false in your profile or solr.in.sh"
fi
else
echo "Could not check ulimits for processes and open files, recommended values are"
echo " max processes: $SOLR_RECOMMENDED_MAX_PROCESSES "
echo " open files: $SOLR_RECOMMENDED_OPEN_FILES"
fi
fi
fi
# Run in foreground (default is to run in the background)
FG="false"
FORCE=false

View File

@ -149,3 +149,14 @@
# -DzkDigestReadonlyUsername=readonly-user -DzkDigestReadonlyPassword=CHANGEME-READONLY-PASSWORD"
#SOLR_OPTS="$SOLR_OPTS $SOLR_ZK_CREDS_AND_ACLS"
# Settings for common system values that may cause operational imparement when system defaults are used.
# Solr can use many processes and many file handles. On modern operating systems the savings by leaving
# these settings low is minuscule, while the consequence can be Solr instability. To turn these checks off, set
# SOLR_ULIMIT_CHECKS=false either here or as part of your profile.
# Different limits can be set in solr.in.sh or your profile if you prefer as well.
#SOLR_RECOMMENDED_OPEN_FILES=
#SOLR_RECOMMENDED_MAX_PROCESSES=
#SOLR_ULIMIT_CHECKS=