You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by da...@apache.org on 2017/12/27 15:04:42 UTC
[49/54] [abbrv] lucene-solr:jira/solr-11702: SOLR-11703: Solr Should
Send Log Notifications if Ulimits are too low
SOLR-11703: Solr Should Send Log Notifications if Ulimits are too low
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/e82e0294
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/e82e0294
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/e82e0294
Branch: refs/heads/jira/solr-11702
Commit: e82e029406b21ccbfebfd36141c2a318f7326453
Parents: 7e321d7
Author: Erick Erickson <er...@apache.org>
Authored: Mon Dec 25 13:22:19 2017 -0800
Committer: Erick Erickson <er...@apache.org>
Committed: Mon Dec 25 13:22:19 2017 -0800
----------------------------------------------------------------------
solr/CHANGES.txt | 2 ++
solr/bin/solr | 34 ++++++++++++++++++++++++++++++++++
solr/bin/solr.in.sh | 11 +++++++++++
3 files changed, 47 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e82e0294/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index f98d71d..1d4ac2a 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -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.
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e82e0294/solr/bin/solr
----------------------------------------------------------------------
diff --git a/solr/bin/solr b/solr/bin/solr
index f9814c2..ef83cee 100755
--- a/solr/bin/solr
+++ b/solr/bin/solr
@@ -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
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e82e0294/solr/bin/solr.in.sh
----------------------------------------------------------------------
diff --git a/solr/bin/solr.in.sh b/solr/bin/solr.in.sh
index 10d8b90..e7478cd 100644
--- a/solr/bin/solr.in.sh
+++ b/solr/bin/solr.in.sh
@@ -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=
+