From 8f989c41a75f004e9b7d2d3c3f142b70ada0bf53 Mon Sep 17 00:00:00 2001 From: Maarten Bezemer Date: Mon, 21 Nov 2016 11:31:25 +0100 Subject: [PATCH] Disable check if ES_HEAP_SIZE exists for ES 5.x ES_HEAP_SIZE is not used for ES5.x anymore, instead ES_JAVA_OPTS 'Xms' and 'Xmx' are used --- templates/init/debian/elasticsearch.j2 | 4 ++++ templates/init/redhat/elasticsearch.j2 | 2 ++ 2 files changed, 6 insertions(+) diff --git a/templates/init/debian/elasticsearch.j2 b/templates/init/debian/elasticsearch.j2 index bc6ed87..68dc12e 100755 --- a/templates/init/debian/elasticsearch.j2 +++ b/templates/init/debian/elasticsearch.j2 @@ -51,9 +51,11 @@ ES_GROUP={{es_group}} # Directory where the Elasticsearch binary distribution resides ES_HOME={{es_home}} +{% if es_version | version_compare('5.0', '<') %} # Heap size defaults to 256m min, 1g max # Set ES_HEAP_SIZE to 50% of available RAM, but no more than 31g #ES_HEAP_SIZE=2g +{% endif %} # Heap new generation #ES_HEAP_NEWSIZE= @@ -137,10 +139,12 @@ case "$1" in start) checkJava +{% if es_version | version_compare('5.0', '<') %} if [ -n "$MAX_LOCKED_MEMORY" -a -z "$ES_HEAP_SIZE" ]; then log_failure_msg "MAX_LOCKED_MEMORY is set - ES_HEAP_SIZE must also be set" exit 1 fi +{% endif %} log_daemon_msg "Starting $DESC" diff --git a/templates/init/redhat/elasticsearch.j2 b/templates/init/redhat/elasticsearch.j2 index 91d23a6..bdb1ad7 100755 --- a/templates/init/redhat/elasticsearch.j2 +++ b/templates/init/redhat/elasticsearch.j2 @@ -90,10 +90,12 @@ checkJava() { start() { checkJava [ -x $exec ] || exit 5 +{% if es_version | version_compare('5.0', '<') %} if [ -n "$MAX_LOCKED_MEMORY" -a -z "$ES_HEAP_SIZE" ]; then echo "MAX_LOCKED_MEMORY is set - ES_HEAP_SIZE must also be set" return 7 fi +{% endif %} if [ -n "$MAX_OPEN_FILES" ]; then ulimit -n $MAX_OPEN_FILES fi