From 4cb22b5643848515d6c345f71c81d86205df7163 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Tue, 30 Apr 2013 17:03:54 -0700 Subject: [PATCH] Give elasticsearch more heap memory. * modules/logstash/files/elasticseach.default: Elasticsearch does not handle running out of memory very gracefully. Recommended allocation is half of the hosts memory. Give elasticsearch 4GB of the 8GB host. * modules/logstash/manifests/elasticseach.pp: Copy new elasticsearch defaults file into place on the host. Change-Id: I9ed14148c901cd3fd4ec38333a722821adb77ff5 Reviewed-on: https://review.openstack.org/27870 Approved: Clark Boylan Reviewed-by: Clark Boylan Tested-by: Jenkins --- modules/logstash/files/elasticsearch.default | 38 ++++++++++++++++++++ modules/logstash/manifests/elasticsearch.pp | 15 +++++++- 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 modules/logstash/files/elasticsearch.default diff --git a/modules/logstash/files/elasticsearch.default b/modules/logstash/files/elasticsearch.default new file mode 100644 index 0000000000..99ecb62ffa --- /dev/null +++ b/modules/logstash/files/elasticsearch.default @@ -0,0 +1,38 @@ +# Run ElasticSearch as this user ID and group ID +#ES_USER=elasticsearch +#ES_GROUP=elasticsearch + +# Heap Size (defaults to 256m min, 1g max) +ES_HEAP_SIZE=4g + +# Heap new generation +#ES_HEAP_NEWSIZE= + +# max direct memory +#ES_DIRECT_SIZE= + +# Maximum number of open files, defaults to 65535. +#MAX_OPEN_FILES=65535 + +# Maximum locked memory size. Set to "unlimited" if you use the +# bootstrap.mlockall option in elasticsearch.yml. You must also set +# ES_HEAP_SIZE. +#MAX_LOCKED_MEMORY=unlimited + +# ElasticSearch log directory +#LOG_DIR=/var/log/elasticsearch + +# ElasticSearch data directory +#DATA_DIR=/var/lib/elasticsearch + +# ElasticSearch work directory +#WORK_DIR=/tmp/elasticsearch + +# ElasticSearch configuration directory +#CONF_DIR=/etc/elasticsearch + +# ElasticSearch configuration file (elasticsearch.yml) +#CONF_FILE=/etc/elasticsearch/elasticsearch.yml + +# Additional Java OPTS +#ES_JAVA_OPTS= diff --git a/modules/logstash/manifests/elasticsearch.pp b/modules/logstash/manifests/elasticsearch.pp index dce00c231a..dd5b28ee7a 100644 --- a/modules/logstash/manifests/elasticsearch.pp +++ b/modules/logstash/manifests/elasticsearch.pp @@ -47,9 +47,22 @@ class logstash::elasticsearch { require => Package['elasticsearch'], } + file { '/etc/default/elasticsearch': + ensure => present, + source => 'puppet:///modules/logstash/elasticsearch.default', + replace => true, + owner => 'root', + group => 'root', + mode => '0644', + require => Package['elasticsearch'], + } + service { 'elasticsearch': ensure => running, require => Package['elasticsearch'], - subscribe => File['/etc/elasticsearch/elasticsearch.yml'], + subscribe => [ + File['/etc/elasticsearch/elasticsearch.yml'], + File['/etc/default/elasticsearch'], + ], } }