From 0bf564d2afda1473d2c57c741fcbea5a4307e528 Mon Sep 17 00:00:00 2001 From: Jean-Bernard Damiano Date: Tue, 23 May 2017 08:05:40 +0200 Subject: [PATCH] support es 5.0 --- attributes/default.rb | 1 + metadata.rb | 2 +- recipes/default.rb | 7 +++++++ templates/default/elasticsearch.yml.erb | 16 +++++++++++++++- 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 600351067..263e0ad3f 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -82,6 +82,7 @@ default.elasticsearch[:index][:mapper][:dynamic] = true default.elasticsearch[:action][:auto_create_index] = true default.elasticsearch[:action][:disable_delete_all_indices] = true +default.elasticsearch[:action][:destructive_requires_name] = true default.elasticsearch[:node][:max_local_storage_nodes] = 1 default.elasticsearch[:discovery][:zen][:ping][:multicast][:enabled] = true diff --git a/metadata.rb b/metadata.rb index 459ae28a3..b5922d725 100644 --- a/metadata.rb +++ b/metadata.rb @@ -5,7 +5,7 @@ license "Apache" description "Installs and configures elasticsearch" long_description IO.read(File.join(File.dirname(__FILE__), 'README.markdown')) -version "1.2.0" +version "5.0.0" depends 'ark', '>= 0.2.4' diff --git a/recipes/default.rb b/recipes/default.rb index 93329f77e..b200441cc 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -6,6 +6,13 @@ Chef::Log.debug "Installation mode #{node[:elasticsearch][:installation][:mode]}" +if node.elasticsearch[:esmajor] >= 5 + default.elasticsearch[:bootstrap][:memory_lock] = node.elasticsearch[:bootstrap][:mlockall] + if node.elasticsearch[:limits][:nofile] < 65536 + default.elasticsearch[:limits][:nofile] = 65536 + end +end + if node[:elasticsearch][:installation][:mode] == 'pkg' case node['platform'] when "ubuntu","debian" diff --git a/templates/default/elasticsearch.yml.erb b/templates/default/elasticsearch.yml.erb index 6b5e3a0b4..7c99f6975 100644 --- a/templates/default/elasticsearch.yml.erb +++ b/templates/default/elasticsearch.yml.erb @@ -31,9 +31,12 @@ <%= print_value 'index.number_of_shards' -%> <%= print_value 'index.number_of_replicas' -%> <%= print_value 'index.auto_expand_replicas' -%> -<%= print_value 'index.mapper.dynamic' -%> <%= print_value 'action.auto_create_index' -%> +<% if node.elasticsearch[:esmajor] < 1 %> <%= print_value 'action.disable_delete_all_indices' -%> +<% else %> +<%= print_value 'action.destructive_requires_name' -%> +<% end %> #################################### Paths #################################### @@ -50,7 +53,12 @@ ################################### Memory #################################### + +<% if node.elasticsearch[:esmajor] < 5 %> <%= print_value 'bootstrap.mlockall' -%> +<% else %> +<%= print_value 'bootstrap.memory_lock' -%> +<% end %> ############################## Network And HTTP ############################### @@ -98,7 +106,9 @@ <%= print_value 'discovery.zen.minimum_master_nodes' -%> <%= print_value 'discovery.zen.ping.timeout' -%> +<% if node[:elasticsearch][:esmajor].to_i < 2 %> <%= print_value 'discovery.zen.ping.multicast.enabled' -%> +<% end %> <%= print_value 'discovery.zen.ping.unicast.hosts' -%> <%- if node.elasticsearch[:cloud] -%> @@ -124,6 +134,9 @@ discovery.ec2.tag.<%= key %>: <%= value %> ################################## Slow Log ################################### + +<% if node.elasticsearch[:esmajor] < 5 %> +<%= print_value 'index.mapper.dynamic' -%> <%= print_value 'index.search.slowlog.threshold.query.warn' -%> <%= print_value 'index.search.slowlog.threshold.query.info' -%> <%= print_value 'index.search.slowlog.threshold.query.debug' -%> @@ -138,6 +151,7 @@ discovery.ec2.tag.<%= key %>: <%= value %> <%= print_value 'index.indexing.slowlog.threshold.index.info' -%> <%= print_value 'index.indexing.slowlog.threshold.index.debug' -%> <%= print_value 'index.indexing.slowlog.threshold.index.trace' -%> +<% end %> ################################## GC Logging #################################