system-config/modules/logstash/manifests/elasticsearch.pp
Clark Boylan 2e6d20c87c Tune ElasticSearch settings.
* modules/logstash/templates/elasticsearch.yml.erb:
Give 33% of memory to indexing instead of 40%.

* modules/logstash/files/es-logstash-template.json:
Flush the translog every 50k operations instead of the default 5k
(we can do 5k ops every second or two so the flushing was happening too
often). Limit the total number of shards per index per node to 3. We
have 5 nodes and 10 shards per index, 5*3 > 10 so we should be fine.
Set the field cache to soft type so that its entries can be garbage
collected in memory constricted situations.

* modules/logstash/manifests/elasticsearch.pp:
Apply es-logstash-template.json to the elasticsearch servers.

Change-Id: I2337fc41998fd00e090b0acfd29f007dfb6ec8df
2013-07-19 16:11:49 -07:00

101 lines
2.9 KiB
Puppet

# Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Class to install elasticsearch.
#
class logstash::elasticsearch (
discover_nodes = ['localhost']
) {
# install java runtime
package { 'java7-runtime-headless':
ensure => present,
}
exec { 'get_elasticsearch_deb':
command => 'wget http://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.20.5.deb -O /tmp/elasticsearch-0.20.5.deb',
path => '/bin:/usr/bin',
creates => '/tmp/elasticsearch-0.20.5.deb',
}
# install elastic search
package { 'elasticsearch':
ensure => latest,
source => '/tmp/elasticsearch-0.20.5.deb',
provider => 'dpkg',
subscribe => Exec['get_elasticsearch_deb'],
require => [
Package['java7-runtime-headless'],
Exec['get_elasticsearch_deb'],
]
}
file { '/etc/elasticsearch/elasticsearch.yml':
ensure => present,
content => template('logstash/elasticsearch.yml.erb'),
replace => true,
owner => 'root',
group => 'root',
mode => '0644',
require => Package['elasticsearch'],
}
file { '/etc/elasticsearch/templates':
ensure => directory,
owner => 'root',
group => 'root',
mode => '0755',
require => Package['elasticsearch'],
}
file { '/etc/elasticsearch/templates/logstash_settings.json':
ensure => present,
source => 'puppet:///modules/logstash/es-logstash-template.json',
replace => true,
owner => 'root',
group => 'root',
mode => '0644',
require => File['/etc/elasticsearch/templates'],
}
file { '/etc/elasticsearch/default-mapping.json':
ensure => present,
source => 'puppet:///modules/logstash/elasticsearch.mapping.json',
replace => true,
owner => 'root',
group => 'root',
mode => '0644',
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'],
File['/etc/elasticsearch/elasticsearch.yml'],
File['/etc/elasticsearch/default-mapping.json'],
File['/etc/default/elasticsearch'],
],
}
}