Add an option to configure the JVM size

By default the JVM launched by Elasticsearch can consume up to 1G of
RAM. This parameter can be set in the plugin UI so the user will
be able to choose up to 32G.

Change-Id: Iefdbb385462b37e5a9d0a9db92f038d029220d92
This commit is contained in:
Guillaume Thouvenin 2015-05-27 14:35:08 +02:00
parent fa4ae03b1c
commit 2b778eaabc
2 changed files with 22 additions and 6 deletions

View File

@ -17,8 +17,9 @@ $elasticsearch_kibana = hiera('elasticsearch_kibana')
if $elasticsearch_kibana['node_name'] == hiera('user_node_name') {
# Params related to Elasticsearch.
$es_dir = $elasticsearch_kibana['data_dir']
$es_instance = 'es-01'
$es_dir = $elasticsearch_kibana['data_dir']
$es_instance = 'es-01'
$es_heap_size = $elasticsearch_kibana['jvm_heap_size']
# Java
$java = $::operatingsystem ? {
@ -33,13 +34,18 @@ if $elasticsearch_kibana['node_name'] == hiera('user_node_name') {
# Install elasticsearch
class { 'elasticsearch':
datadir => ["${es_dir}/elasticsearch_data"],
require => [Package[$java]],
datadir => ["${es_dir}/elasticsearch_data"],
init_defaults => {
'MAX_LOCKED_MEMORY' => 'unlimited',
'ES_HEAP_SIZE' => "${es_heap_size}g"
},
require => Package[$java],
}
# Start an instance of elasticsearch
elasticsearch::instance { $es_instance:
config => {
'bootstrap.mlockall' => true,
'http.cors.allow-origin' => '/.*/',
'http.cors.enabled' => true
},

View File

@ -3,7 +3,7 @@ attributes:
node_name:
value: 'elasticsearch'
label: 'Node name'
description: 'The name of the node where the plugin will be deployed'
description: 'The name of the node where the plugin will be deployed.'
weight: 10
type: "text"
@ -11,13 +11,23 @@ attributes:
data_dir:
value: '/opt/es-data'
label: 'Elasticsearch directory'
description: 'Directory used by elasticsearch to store data'
description: 'Directory used by elasticsearch to store data.'
weight: 15
type: "text"
restrictions:
- condition: "true"
action: hide
jvm_heap_size:
value: '1'
label: 'JVM heap size'
description: 'in GB (between 1 and 32). The amount of memory reserved for the JVM.'
weight: 18
type: "text"
regex:
source: '^([1-9]|[12][0-9]|3[0-2])$'
error: 'Enter a value between 1 and 32'
disk1:
value: ''
label: 'Disk 1'