Gehel has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/333969 )

Change subject: Update elasticsearch module for es5 compatability
......................................................................


Update elasticsearch module for es5 compatability

The end result of this patch is that elasticsearch 2 and 5 must have
separate configuration and defaults files. This is needed due to 5.x
renaming and removing some values in the config file.

The defaults file for ES5 was sourced from upstream and modified to
meet our previous configuration. The main elasticsearch.yml file is
a copy of our elasticsearch 2 config updated for compatibility with 5.

Additionally this patch configures relforge to use elasticsearch 5. That
doesn't necessarily need to be in the final merged patch, but is done
to allow puppet-compiler to report on how things change with the 2->5
upgrade.

* ES_HEAP_SIZE is no longer supported in 5.x. 2.x retains the setting,
  in 5.x this was moved to Setting -Xmx and -Xms in jvm.options
* 5.x now uses log4j2.properties, instead of a custom logging.yml file.
  On updating to 5.x logging.yml will be removed and log4j2.properties
  will be created.
* shipping logs to logstash is commented out in the log4j2 configuration as
  it requires further testing. And that testing requires a deployment of ES5.
* ES 5.x no longer has a path.plugins config value. When running 5.x
  that will now be symlinked into /usr/share/elasticsearch/plugins
* ES 5.x renamed threadpool to thread_pool
* ES 5.x renamed mlockall to memory_lock
* ES 5.x disallows setting thread_pool types. fixed was already the
  default, so simply removed the explicit setting.
* Global index settings can no longer be set in elasticsearch.yml, they
  must be set per-index. They are now set by CirrusSearch at index
  creation time via settings in mediawiki-config repo.
* disable_shutdown setting no longer exists. The _shutdown API has been
  removed without replacement.
* cluster.routing.allocation.primary was deprecated in 1.3.8, and was
  removed in 2.x. This hasn't done anything for some time, but 5.x
  finally checks for unknown configuration so it needs to be removed.
* multicast was removed from elasticsearch 5. Remove the relevant
  configuration from puppet as well. Default to off for elasticsearch 2
  (we wern't using it anymore).
* indices.cache.filter.size renamed to indices.queries.cache.size in
  2.0, so this setting hasn't been doing anything for some time. Patch
  fixes the name, but perhaps we should remove instead?
* removed indices.recovery.concurrent_streams which was deprecated in
  1.x, removed in 5.x.  superseded by
  cluster.routing.allocation.node_concurrent_recoveries which we already
  set.
* removed profile setting, this was for the language detect plugin which
  we tested but decided against and no longer install.

Bug: T155578
Change-Id: I51fa32aecdbbaad3766522c8b3a1e3adafd7c7fa
---
M hieradata/labs.yaml
M hieradata/labs/deployment-prep/common.yaml
M hieradata/labs/tools/common.yaml
M hieradata/role/common/elasticsearch/cirrus.yaml
M hieradata/role/common/elasticsearch/relforge.yaml
M hieradata/role/common/logstash/collector.yaml
M hieradata/role/common/logstash/elasticsearch.yaml
M modules/elasticsearch/manifests/init.pp
M modules/elasticsearch/spec/classes/elasticsearch_rspec.rb
R modules/elasticsearch/templates/elasticsearch_2.erb
R modules/elasticsearch/templates/elasticsearch_2.yml.erb
A modules/elasticsearch/templates/elasticsearch_5.erb
C modules/elasticsearch/templates/elasticsearch_5.yml.erb
A modules/elasticsearch/templates/jvm.options.erb
A modules/elasticsearch/templates/log4j2.properties.erb
M modules/role/manifests/elasticsearch/common.pp
16 files changed, 231 insertions(+), 121 deletions(-)

Approvals:
  jenkins-bot: Verified
  Gehel: Looks good to me, approved



diff --git a/hieradata/labs.yaml b/hieradata/labs.yaml
index 16a8d00..7063f40 100644
--- a/hieradata/labs.yaml
+++ b/hieradata/labs.yaml
@@ -25,6 +25,7 @@
 statsd: labmon1001.eqiad.wmnet:8125
 
 # Other overrides
+elasticsearch::version: 2
 elasticsearch::minimum_master_nodes: 1
 elasticsearch::recover_after_time: "1m"
 elasticsearch::heap_memory: '2G'
diff --git a/hieradata/labs/deployment-prep/common.yaml 
b/hieradata/labs/deployment-prep/common.yaml
index 7cee964..7b7981a 100644
--- a/hieradata/labs/deployment-prep/common.yaml
+++ b/hieradata/labs/deployment-prep/common.yaml
@@ -187,6 +187,7 @@
 "mediawiki::users::mwdeploy_pub_key": 'ssh-rsa 
AAAAB3NzaC1yc2EAAAADAQABAAABAQDFwlmBBBJAr1GI+vuYjFh5vq0YIVa5fqE5DZdpzUZISlQ0Kt+9bIr2qNHIj+Jl5Bc6ZY1mkh8l693tAHVx+8tayoiFWYNs9IVsxR+iHgOOhAdDIBXaHaUattdiye5bQmdvJVXaVegckNX2gbmUCOc09jvZvlk3blKFTSEpZRU8dmpXQzKdZgaAq2VTajAegoFnuN9FbC7hzBPA+1NxFNKn94eIeFPSlo5rWr44OEb5Uy3O0B5c6WPM+IgfiygetP+yGL4cKv7qEjZ0Sxok/Rh1lBh1vP1YQ/Mc6tMV0s+kOv7Wz+P88bfU1/uWvy479OZdfh3NQqDTrLzqHwVW1vef
 root@deployment-salt'
 # NOTE: these elasticsearch settings will need to be overloaded on a per-host
 # basis for the Logstash Elasticsearch cluster.
+"elasticsearch::version": 2
 "elasticsearch::expected_nodes": 3
 "elasticsearch::minimum_master_nodes": 2
 "elasticsearch::heap_memory": 4G
diff --git a/hieradata/labs/tools/common.yaml b/hieradata/labs/tools/common.yaml
index 3522dba..24c35d4 100644
--- a/hieradata/labs/tools/common.yaml
+++ b/hieradata/labs/tools/common.yaml
@@ -11,6 +11,7 @@
   - yuvipanda
 
 # Elasticsearch
+elasticsearch::version: 2
 elasticsearch::auto_create_index: true
 elasticsearch::cluster_name: labs-tools
 elasticsearch::expected_nodes: 3
diff --git a/hieradata/role/common/elasticsearch/cirrus.yaml 
b/hieradata/role/common/elasticsearch/cirrus.yaml
index ecac5a2..b735d2c 100644
--- a/hieradata/role/common/elasticsearch/cirrus.yaml
+++ b/hieradata/role/common/elasticsearch/cirrus.yaml
@@ -3,6 +3,9 @@
 admin::groups:
   - elasticsearch-roots
 
+# Version of elasticsearch to build configuration for
+elasticsearch::version: 2
+
 # More than 30G isn't very useful
 elasticsearch::heap_memory: '30G'
 
diff --git a/hieradata/role/common/elasticsearch/relforge.yaml 
b/hieradata/role/common/elasticsearch/relforge.yaml
index 7184ac8..af96bc7 100644
--- a/hieradata/role/common/elasticsearch/relforge.yaml
+++ b/hieradata/role/common/elasticsearch/relforge.yaml
@@ -3,6 +3,9 @@
 admin::groups:
   - elasticsearch-roots
 
+# Version of elasticsearch to configure
+elasticsearch::version: 5
+
 # Nodes should not be master eligible by default in prod
 elasticsearch::master_eligible: false
 
diff --git a/hieradata/role/common/logstash/collector.yaml 
b/hieradata/role/common/logstash/collector.yaml
index 2b30b6c..6c9bb53 100644
--- a/hieradata/role/common/logstash/collector.yaml
+++ b/hieradata/role/common/logstash/collector.yaml
@@ -6,6 +6,7 @@
 # ES-specific
 # NOTE: cluster_name must be kept in sync with the backend
 # node config in hieradata/role/common/logstash/elasticsearch.yaml
+elasticsearch::version: 2
 elasticsearch::auto_create_index: true
 elasticsearch::cluster_name: production-logstash-eqiad
 elasticsearch::expected_nodes: 3
diff --git a/hieradata/role/common/logstash/elasticsearch.yaml 
b/hieradata/role/common/logstash/elasticsearch.yaml
index 7542f99..31b78fa 100644
--- a/hieradata/role/common/logstash/elasticsearch.yaml
+++ b/hieradata/role/common/logstash/elasticsearch.yaml
@@ -7,6 +7,7 @@
 # ES-specific
 # NOTE: cluster_name must be kept in sync with the backend
 # node config in hieradata/role/common/logstash.yaml
+elasticsearch::version: 2
 elasticsearch::auto_create_index: true
 elasticsearch::cluster_name: production-logstash-eqiad
 elasticsearch::expected_nodes: 3
diff --git a/modules/elasticsearch/manifests/init.pp 
b/modules/elasticsearch/manifests/init.pp
index 40ab9ad..c383880 100644
--- a/modules/elasticsearch/manifests/init.pp
+++ b/modules/elasticsearch/manifests/init.pp
@@ -10,8 +10,6 @@
 # - $heap_memory:   amount of memory to allocate to elasticsearch.  Defaults to
 #       "2G".  Should be set to about half of ram or a 30G, whichever is
 #       smaller.
-# - $multicast_group:  multicast group to use for peer discovery.  Defaults to
-#       elasticsearch's default: '224.2.2.4'.
 # - $data_dir: Where elasticsearch stores its data.
 #       Default: /srv/elasticsearch
 # - $plugins_dir: value for path.plugins.  Defaults to 
/srv/deployment/elasticsearch/plugins.
@@ -46,18 +44,8 @@
 #       to undef meaning don't set it.
 # - $rack: rack this node is on.  Can be used for allocation awareness.
 #       Defaults to undef meaning don't set it.
-# - $multicast_enabled: Should multicast be enabled. See
-#       
https://www.elastic.co/guide/en/elasticsearch/reference/1.7/modules-discovery-zen.html
-#       for more documentation.
-#       Note: It make sense to have multicast configuration separated from
-#       unicast. It is valid to have both unicast and multicast enabled at the
-#       same time and can be useful as a transition state.
-#       Defaults to 'false'
 # - $unicast_hosts: hosts to seed Elasticsearch's unicast discovery mechanism.
-#       In an environment without reliable multicast (OpenStack) add all the
-#       hosts in the cluster to this list.  Elasticsearch will still use
-#       multicast discovery but this will keep it from getting lost if none of
-#       its pings reach other servers.
+#       Add all the hosts in the cluster to this list.
 # - $bind_networks: networks to bind (both transport and http connectors)
 #       see 
https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-network.html#network-interface-values
 # - $publish_host: host to publish (both transport and http connectors)
@@ -69,8 +57,6 @@
 # - $bulk_thread_pool_executors: number of executors for bulk actions on each
 #       node.
 # - $statsd_host: host to send statsd data to
-# - $merge_threads: Number of merge threads to use. Default 3. Set
-#        to 1 if using spinning disks.
 # - $load_fixed_bitset_filters_eagerly: set to false to disable loading
 #        bitsets in memory when opening indices will slowdown queries but can
 #        significantly reduce heap usage.
@@ -90,7 +76,6 @@
 class elasticsearch(
     $cluster_name,
     $heap_memory = '2G',
-    $multicast_group = '224.2.2.4',
     $data_dir = '/srv/elasticsearch',
     $plugins_dir = '/srv/deployment/elasticsearch/plugins',
     $plugins_mandatory = undef,
@@ -104,20 +89,19 @@
     $awareness_attributes = undef,
     $row = undef,
     $rack = undef,
-    $multicast_enabled = false,
-    $unicast_hosts = undef,
+    $unicast_hosts = [],
     $bind_networks = ['_local_', '_site_'],
     $publish_host = '_eth0_',
     $filter_cache_size = '10%',
     $bulk_thread_pool_executors = undef,
     $bulk_thread_pool_capacity = undef,
     $statsd_host = undef,
-    $merge_threads = 3,
     $load_fixed_bitset_filters_eagerly = true,
     $graylog_hosts = undef,
     $graylog_port = 12201,
     $gc_log = true,
     $java_package = 'openjdk-8-jdk',
+    $version = 5,
 ) {
 
     # Check arguments
@@ -125,7 +109,11 @@
         fail('$cluster_name must not be set to "elasticsearch"')
     }
 
-    validate_bool($multicast_enabled)
+    case $version {
+        2, 5: {}
+        default: { fail("Unsupported elasticsearch version: ${version}") }
+    }
+
     validate_bool($gc_log)
 
     # if no graylog_host is given, do not send logs
@@ -159,24 +147,64 @@
         java_package => $java_package,
     }
 
+    # Elasticsearch 5 doesn't allow setting the plugin path, we need
+    # to symlink it into place
+    file { '/usr/share/elasticsearch/plugins':
+        ensure => 'link',
+        target => $plugins_dir,
+    }
+
     file { '/etc/elasticsearch/elasticsearch.yml':
         ensure  => file,
         owner   => 'root',
         group   => 'root',
-        content => template('elasticsearch/elasticsearch.yml.erb'),
+        content => template("elasticsearch/elasticsearch_${version}.yml.erb"),
         mode    => '0444',
         require => Package['elasticsearch'],
     }
-    file { '/etc/elasticsearch/logging.yml':
-        ensure  => file,
-        owner   => 'root',
-        group   => 'root',
-        content => template('elasticsearch/logging.yml.erb'),
-        mode    => '0444',
-        require => Package['elasticsearch'],
+    if $version == 2 {
+        # logging.yml is used by elasticsearch 2.x
+        file { '/etc/elasticsearch/logging.yml':
+            ensure  => file,
+            owner   => 'root',
+            group   => 'root',
+            content => template('elasticsearch/logging.yml.erb'),
+            mode    => '0444',
+            require => Package['elasticsearch'],
+        }
+        # Needs to be defined so the service definition can depend on
+        # it being setup in elasticsearch 5
+        file { '/etc/elasticsearch/log4j2.properties':
+            ensure => absent,
+        }
+        file { '/etc/elasticsearch/jvm.options':
+            ensure => absent,
+        }
+    } else {
+        file { '/etc/elasticsearch/logging.yml':
+            ensure => absent,
+        }
+        # log4j2.properties is used by elasticsearch 5.x
+        file { '/etc/elasticsearch/log4j2.properties':
+            ensure  => file,
+            owner   => 'root',
+            group   => 'root',
+            content => template('elasticsearch/log4j2.properties.erb'),
+            mode    => '0444',
+            require => Package['elasticsearch'],
+        }
+        file { '/etc/elasticsearch/jvm.options':
+            ensure  => file,
+            owner   => 'root',
+            group   => 'root',
+            content => template('elasticsearch/jvm.options.erb'),
+            mode    => '0444',
+            require => Package['elasticsearch'],
+        }
     }
+
     # elasticsearch refuses to start without the "scripts" directory, even if
-    # do not actually use any scripts.
+    # we do not actually use any scripts.
     file { '/etc/elasticsearch/scripts':
         ensure  => directory,
         owner   => 'root',
@@ -188,7 +216,7 @@
         ensure  => file,
         owner   => 'root',
         group   => 'root',
-        content => template('elasticsearch/elasticsearch.erb'),
+        content => template("elasticsearch/elasticsearch_${version}.erb"),
         mode    => '0444',
         require => Package['elasticsearch'],
     }
@@ -226,7 +254,10 @@
             Package['elasticsearch'],
             File['/etc/elasticsearch/elasticsearch.yml'],
             File['/etc/elasticsearch/logging.yml'],
+            File['/etc/elasticsearch/log4j2.properties'],
+            File['/etc/elasticsearch/jvm.options'],
             File['/etc/default/elasticsearch'],
+            File['/usr/share/elasticsearch/plugins'],
             File[$data_dir],
         ],
     }
diff --git a/modules/elasticsearch/spec/classes/elasticsearch_rspec.rb 
b/modules/elasticsearch/spec/classes/elasticsearch_rspec.rb
index aaac604..413cfd8 100644
--- a/modules/elasticsearch/spec/classes/elasticsearch_rspec.rb
+++ b/modules/elasticsearch/spec/classes/elasticsearch_rspec.rb
@@ -5,28 +5,6 @@
                   :lsbdistid      => 'trusty'
   } }
 
-  describe 'when multicast enabled' do
-    let(:params) { {
-        :cluster_name      => 'my_cluster_name',
-        :multicast_enabled => true,
-    } }
-    it { is_expected.to contain_file('/etc/elasticsearch/elasticsearch.yml')
-                            
.with_content(/^#discovery\.zen\.ping\.multicast\.enabled: false$/)
-                            
.without_content(/^discovery\.zen\.ping\.multicast\.enabled: false$/)
-    }
-  end
-
-  describe 'when multicast disabled' do
-    let(:params) { {
-        :cluster_name      => 'my_cluster_name',
-        :multicast_enabled => false,
-    } }
-    it { is_expected.to contain_file('/etc/elasticsearch/elasticsearch.yml')
-                            
.with_content(/^discovery\.zen\.ping\.multicast\.enabled: false$/)
-                            
.without_content(/^#discovery\.zen\.ping\.multicast\.enabled: false$/)
-    }
-  end
-
   describe 'when GC logging is enabled' do
     let(:params) { {
         :cluster_name => 'my_cluster_name',
diff --git a/modules/elasticsearch/templates/elasticsearch.erb 
b/modules/elasticsearch/templates/elasticsearch_2.erb
similarity index 100%
rename from modules/elasticsearch/templates/elasticsearch.erb
rename to modules/elasticsearch/templates/elasticsearch_2.erb
diff --git a/modules/elasticsearch/templates/elasticsearch.yml.erb 
b/modules/elasticsearch/templates/elasticsearch_2.yml.erb
similarity index 98%
rename from modules/elasticsearch/templates/elasticsearch.yml.erb
rename to modules/elasticsearch/templates/elasticsearch_2.yml.erb
index aa36326..b46bebd 100644
--- a/modules/elasticsearch/templates/elasticsearch.yml.erb
+++ b/modules/elasticsearch/templates/elasticsearch_2.yml.erb
@@ -300,7 +300,6 @@
 # than 1 when running more than 2 nodes in the cluster.
 #
 discovery.zen.minimum_master_nodes: <%= @minimum_master_nodes %>
-discovery.zen.ping.multicast.group: <%= @multicast_group %>
 
 # Set the time to wait for ping responses from other nodes when discovering.
 # Set this option to a higher value on a slow or congested network
@@ -317,11 +316,7 @@
 #
 # 1. Disable multicast discovery (enabled by default):
 #
-<% if @multicast_enabled -%>
-#discovery.zen.ping.multicast.enabled: false
-<% else -%>
 discovery.zen.ping.multicast.enabled: false
-<% end -%>
 #
 # 2. Configure an initial list of master nodes in the cluster
 #    to perform discovery when new nodes (master or data) are started:
@@ -470,7 +465,7 @@
 ##
 # Merge Threads
 ##
-index.merge.scheduler.max_thread_count: <%= @merge_threads %>
+index.merge.scheduler.max_thread_count: 1
 
 <% unless @load_fixed_bitset_filters_eagerly -%>
 ##
diff --git a/modules/elasticsearch/templates/elasticsearch_5.erb 
b/modules/elasticsearch/templates/elasticsearch_5.erb
new file mode 100644
index 0000000..6c2331f
--- /dev/null
+++ b/modules/elasticsearch/templates/elasticsearch_5.erb
@@ -0,0 +1,65 @@
+################################
+# Elasticsearch
+################################
+
+# Elasticsearch home directory
+#ES_HOME=/usr/share/elasticsearch
+
+# Elasticsearch Java path
+#JAVA_HOME=
+
+# Elasticsearch configuration directory
+#CONF_DIR=/etc/elasticsearch
+
+# Elasticsearch data directory
+DATA_DIR=<%= @data_dir %>
+
+# Elasticsearch logs directory
+#LOG_DIR=/var/log/elasticsearch
+
+# Elasticsearch PID directory
+#PID_DIR=/var/run/elasticsearch
+
+# Additional Java OPTS
+#ES_JAVA_OPTS=
+
+# Configure restart on package upgrade (true, every other setting will lead to 
not restarting)
+#RESTART_ON_UPGRADE=true
+
+################################
+# Elasticsearch service
+################################
+
+# SysV init.d
+#
+# When executing the init script, this user will be used to run the 
elasticsearch service.
+# The default value is 'elasticsearch' and is declared in the init.d file.
+# Note that this setting is only used by the init script. If changed, make 
sure that
+# the configured user can read and write into the data, work, plugins and log 
directories.
+# For systemd service, the user is usually configured in file 
/usr/lib/systemd/system/elasticsearch.service
+#ES_USER=elasticsearch
+#ES_GROUP=elasticsearch
+
+# The number of seconds to wait before checking if Elasticsearch started 
successfully as a daemon process
+ES_STARTUP_SLEEP_TIME=5
+
+################################
+# System properties
+################################
+# Specifies the maximum file descriptor number that can be opened by this 
process
+# When using Systemd, this setting is ignored and the LimitNOFILE defined in
+# /usr/lib/systemd/system/elasticsearch.service takes precedence
+#MAX_OPEN_FILES=65536
+
+# The maximum number of bytes of memory that may be locked into RAM
+# Set to "unlimited" if you use the 'bootstrap.memory_lock: true' option
+# in elasticsearch.yml.
+# When using Systemd, the LimitMEMLOCK property must be set
+# in /usr/lib/systemd/system/elasticsearch.service
+MAX_LOCKED_MEMORY=unlimited
+
+# Maximum number of VMA (Virtual Memory Areas) a process can own
+# When using Systemd, this setting is ignored and the 'vm.max_map_count'
+# property is set at boot time in /usr/lib/sysctl.d/elasticsearch.conf
+#MAX_MAP_COUNT=262144
+
diff --git a/modules/elasticsearch/templates/elasticsearch.yml.erb 
b/modules/elasticsearch/templates/elasticsearch_5.yml.erb
similarity index 88%
copy from modules/elasticsearch/templates/elasticsearch.yml.erb
copy to modules/elasticsearch/templates/elasticsearch_5.yml.erb
index aa36326..f80f5c7 100644
--- a/modules/elasticsearch/templates/elasticsearch.yml.erb
+++ b/modules/elasticsearch/templates/elasticsearch_5.yml.erb
@@ -80,7 +80,7 @@
 # for customized shard allocation filtering, or allocation awareness. An 
attribute
 # is a simple key value pair, similar to node.key: value, here is an example:
 #
-#node.rack: rack314
+#node.attr.rack: rack314
 
 # By default, multiple nodes are allowed to start from the same installation 
location
 # to disable it, set the following:
@@ -169,7 +169,7 @@
 
 # If a plugin listed here is not installed for current node, the node will not 
start.
 #
-<%= @plugins_mandatory ? "plugin.mandatory: 
#{Array(@plugins_mandatory).join(',')}" : '#plugin.mandatory: 
mapper-attachments,lang-groovy' %>
+<%= @plugins_mandatory ? "plugin.mandatory: 
#{Array(@plugins_mandatory).join(',')}" : '#plugin.mandatory: 
mapper-attachments' %>
 
 
 ################################### Memory ####################################
@@ -179,7 +179,7 @@
 #
 # Set this property to true to lock the memory:
 #
-bootstrap.mlockall: true
+bootstrap.memory_lock: true
 
 # Make sure that the ES_MIN_MEM and ES_MAX_MEM environment variables are set
 # to the same value, and that the machine has enough memory to allocate
@@ -285,11 +285,6 @@
 indices.recovery.max_bytes_per_sec: 20mb
 
 
-# Set to limit the number of open concurrent streams when
-# recovering a shard from a peer:
-indices.recovery.concurrent_streams: 3
-
-
 ################################## Discovery ##################################
 
 # Discovery infrastructure ensures nodes can be found within a cluster
@@ -300,7 +295,6 @@
 # than 1 when running more than 2 nodes in the cluster.
 #
 discovery.zen.minimum_master_nodes: <%= @minimum_master_nodes %>
-discovery.zen.ping.multicast.group: <%= @multicast_group %>
 
 # Set the time to wait for ping responses from other nodes when discovering.
 # Set this option to a higher value on a slow or congested network
@@ -311,26 +305,12 @@
 # See <http://elasticsearch.org/guide/reference/modules/discovery/zen.html>
 # for more information.
 
-# Unicast discovery allows to explicitly control which nodes will be used
-# to discover the cluster. It can be used when multicast is not present,
-# or to restrict the cluster communication-wise.
+# Unicast discovery controls which nodes will be used to discover the cluster.
 #
-# 1. Disable multicast discovery (enabled by default):
+# Configure an initial list of master nodes in the cluster
+# to perform discovery when new nodes (master or data) are started:
 #
-<% if @multicast_enabled -%>
-#discovery.zen.ping.multicast.enabled: false
-<% else -%>
-discovery.zen.ping.multicast.enabled: false
-<% end -%>
-#
-# 2. Configure an initial list of master nodes in the cluster
-#    to perform discovery when new nodes (master or data) are started:
-#
-<% if @unicast_hosts -%>
 discovery.zen.ping.unicast.hosts: [<%= @unicast_hosts.collect{ |x| "\"#{x}\"" 
}.join(', ') %>]
-<% else -%>
-#discovery.zen.ping.unicast.hosts: ["host1", "host2:port"]
-<% end -%>
 
 # EC2 discovery allows to use AWS EC2 API in order to perform discovery.
 #
@@ -353,20 +333,6 @@
 # You have to install the cloud-azure plugin for enabling the Azure discovery.
 #
 # For more information, see 
<https://github.com/elasticsearch/elasticsearch-cloud-azure>.
-
-################################## Slow Log ##################################
-
-# Shard level query and fetch threshold logging.
-
-index.search.slowlog.threshold.fetch.warn: 1s
-index.search.slowlog.threshold.fetch.info: 800ms
-index.search.slowlog.threshold.fetch.debug: 500ms
-index.search.slowlog.threshold.fetch.trace: 200ms
-
-index.indexing.slowlog.threshold.index.warn: 10s
-index.indexing.slowlog.threshold.index.info: 5s
-index.indexing.slowlog.threshold.index.debug: 2s
-index.indexing.slowlog.threshold.index.trace: -1
 
 ################################## GC Logging ################################
 
@@ -394,12 +360,6 @@
 action.destructive_requires_name: true
 
 ##
-# Disable ability to shutdown nodes via REST API.
-##
-action.disable_shutdown: true
-
-
-##
 # Enable the disk space aware shard allocator
 ##
 cluster.routing.allocation.disk.threshold_enabled: true
@@ -423,8 +383,8 @@
 # Row/rack awareness attributes
 ##
 <% if @awareness_attributes %>cluster.routing.allocation.awareness.attributes: 
<%= @awareness_attributes %><% end %>
-<% if @row  %>node.row: <%=  @row  %><% end %>
-<% if @rack %>node.rack: <%= @rack %><% end %>
+<% if @row  %>node.attr.row: <%=  @row  %><% end %>
+<% if @rack %>node.attr.rack: <%= @rack %><% end %>
 
 
 ##
@@ -435,21 +395,19 @@
 cluster.routing.allocation.balance:
     shard: 0.195
     index: 0.8
-    primary: 0.005
 
 ##
 # Filter cache size
 ##
-indices.cache.filter.size: <%= @filter_cache_size %>
+indices.queries.cache.size: <%= @filter_cache_size %>
 
 <% if @bulk_thread_pool_capacity or @bulk_thread_pool_executors -%>
 ##
 # Thread pool settings
 ##
 <% if @bulk_thread_pool_capacity or @bulk_thread_pool_executors -%>
-threadpool:
+thread_pool:
     bulk:
-        type: fixed
 <% if @bulk_thread_pool_executors -%>
         size: <%= @bulk_thread_pool_executors %>
 <% end -%>
@@ -467,10 +425,6 @@
 <% end -%>
 
 
-##
-# Merge Threads
-##
-index.merge.scheduler.max_thread_count: <%= @merge_threads %>
 
 <% unless @load_fixed_bitset_filters_eagerly -%>
 ##
@@ -480,7 +434,3 @@
 index.load_fixed_bitset_filters_eagerly: false
 
 <% end -%>
-##
-# Set /langdetect/short-text/ the default langdect profile
-##
-profile: "/langdetect/short-text/"
diff --git a/modules/elasticsearch/templates/jvm.options.erb 
b/modules/elasticsearch/templates/jvm.options.erb
new file mode 100644
index 0000000..04ea966
--- /dev/null
+++ b/modules/elasticsearch/templates/jvm.options.erb
@@ -0,0 +1,6 @@
+-Xms<%= @heap_memory %>
+-Xmx<%= @heap_memory %>
+-XX:HeapDumpPath=<%= @data_dir %>
+-XX:GCTimeLimit=70
+-XX:GCHeapFreeLimit=10
+<%= gc_log_flags.join('\n') %>
diff --git a/modules/elasticsearch/templates/log4j2.properties.erb 
b/modules/elasticsearch/templates/log4j2.properties.erb
new file mode 100644
index 0000000..9f04d37
--- /dev/null
+++ b/modules/elasticsearch/templates/log4j2.properties.erb
@@ -0,0 +1,77 @@
+
+rootLogger.level = info
+rootLogger.appenderRef.console.ref = console
+rootLogger.appenderRef.file.ref = file
+<% if @send_logs_to_logstash %>
+#rootLogger.appenderRef.ship_to_logstash.ref = ship_to_logstash
+<% end %>
+
+# log action execution errors for easier debugging
+logger.action.name = org.elasticsearch.action
+logger.action.level = debug
+
+# This is noisy and already filed upstream:
+# https://github.com/elasticsearch/elasticsearch/issues/4203
+# @TODO: Still needed?
+logger.node_stats.name = org.elasticsearch.action.admin.cluster.node.stats
+logger.node_stats.level = info
+
+# If you need to know more about shard allocation you to set this to debug.
+# Trace seems to generate enough logs to slow down the process.
+# logger.cluster.name = org.elasticsearch.cluster
+# logger.cluster.level = debug
+
+# peer shard recovery
+# logger.indices_recovery.name = org.elasticsearch.indices.recovery
+# logger.indices_recovery.level = debug
+
+# discovery
+# logger.discovery.name = org.elasticsearch.discovery
+# logger.discovery.level = trace
+
+logger.search_slowlog.name = index.search.slowlog
+logger.search_slowlog.level = trace
+logger.search_slowlog.additivity = false
+logger.search_slowlog.appenderRef.slowlog.ref = index_search_slow_log_file
+logger.indexing_slowlog.name = index.indexing.slowlog
+logger.indexing_slowlog.level = info
+logger.indexing_slowlog.additivity = false
+logger.indexing_slowlog.appenderRef.slowlog.ref = index_search_slow_log_file
+
+appender.console.type = Console
+appender.console.name = console
+appender.console.layout.type = PatternLayout
+appender.console.layout.pattern = [%d{ISO8601}][%-5p][%-25c] %m%n
+
+appender.file.name = file
+appender.file.type = File
+appender.file.fileName = ${sys:es.logs}.log
+appender.file.append = true
+appender.file.layout.type = PatternLayout
+appender.file.layout.pattern = [%d{ISO8601}][%-5p][%-25c] %m%n
+
+appender.index_search_slow_log_file.name = index_search_slow_log_file
+appender.index_search_slow_log_file.type = File
+appender.index_search_slow_log_file.fileName = 
${sys:es.logs}_index_search_slowlog.log
+appender.index_search_slow_log_file.append = true
+appender.index_search_slow_log_file.layout.type = PatternLayout
+appender.index_search_slow_log_file.layout.pattern = 
[%d{ISO8601}][%-5p][%-25c] %m%n
+
+appender.index_indexing_slow_log_file.name = index_indexing_slow_log_file
+appender.index_indexing_slow_log_file.type = File
+appender.index_indexing_slow_log_file.fileName = 
${sys:es.logs}_index_indexing_slowlog.log
+appender.index_indexing_slow_log_file.append = true
+appender.index_indexing_slow_log_file.layout.type = PatternLayout
+appender.index_indexing_slow_log_file.layout.pattern = 
[%d{ISO8601}][%-5p][%-25c] %m%n
+
+# ship_to_logstash needs to also be added to rootLogger to actually ship logs
+# @TODO This class is for log4j v1, for v2 should we test
+# org.graylog2.log4j2.GelfAppender ?
+#appender.ship_to_logstash.name = ship_to_logstash
+#appender.ship_to_logstash.type = biz.paluch.logging.gelf.log4j.GelfLogAppender
+#appender.ship_to_logstash.host = udp:<%= @graylog_host %>
+#appender.ship_to_logstash.port <%= @graylog_port %>
+#appender.ship_to_logstash.originHost = <%= @hostname %>
+#appender.ship_to_logstash.facility = elasticsearch
+#appender.ship_to_logstash.extractStackTrace = true
+#appender.ship_to_logstash.threshold = DEBUG
diff --git a/modules/role/manifests/elasticsearch/common.pp 
b/modules/role/manifests/elasticsearch/common.pp
index c1b14e1..20d97d2 100644
--- a/modules/role/manifests/elasticsearch/common.pp
+++ b/modules/role/manifests/elasticsearch/common.pp
@@ -69,9 +69,6 @@
         filter_cache_size          => '20%',
         bulk_thread_pool_executors => 6,
         bulk_thread_pool_capacity  => 1000,
-        # Use only 1 merge thread (instead of 3) to avoid updates interfering 
with
-        # actual searches
-        merge_threads              => 1,
     }
 
     include ::standard

-- 
To view, visit https://gerrit.wikimedia.org/r/333969
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I51fa32aecdbbaad3766522c8b3a1e3adafd7c7fa
Gerrit-PatchSet: 10
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: EBernhardson <[email protected]>
Gerrit-Reviewer: DCausse <[email protected]>
Gerrit-Reviewer: EBernhardson <[email protected]>
Gerrit-Reviewer: Gehel <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to