From 9222b1ffd86caef51be1dca35d1526d5c4d36b52 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Mon, 7 Jul 2014 16:50:02 -0700 Subject: [PATCH] Use local ES balancers on logstash workers Set up small non master non data elasticsearch daemons on logstash workers to act as local load balancers for the elasticsearch http protocol. Change-Id: Ie3729f851ebef3331a6b69f718e57d663209bfc2 --- manifests/init.pp | 12 ++++++++---- templates/elasticsearch.yml.erb | 7 +++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index eadb1c0..3155acb 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -20,14 +20,18 @@ class elasticsearch ( $es_template_config = {} ) { # install java runtime - package { 'openjdk-7-jre-headless': - ensure => present, + if ! defined(Package['openjdk-7-jre-headless']) { + package { 'openjdk-7-jre-headless': + ensure => present, + } } # Curl is handy for talking to the ES API on localhost. Allows for # querying cluster state and deleting indexes and so on. - package { 'curl': - ensure => present, + if ! defined(Package['curl']) { + package { 'curl': + ensure => present, + } } exec { 'get_elasticsearch_deb': diff --git a/templates/elasticsearch.yml.erb b/templates/elasticsearch.yml.erb index b612213..04b20bd 100644 --- a/templates/elasticsearch.yml.erb +++ b/templates/elasticsearch.yml.erb @@ -86,6 +86,13 @@ node.name: "<%= scope.lookupvar("::hostname") %>" # to disable it, set the following: # node.max_local_storage_nodes: 1 +<% if es_template_config.has_key?('node.master') then -%> +node.master: <%= es_template_config['node.master'] %> +<% end -%> +<% if es_template_config.has_key?('node.data') then -%> +node.data: <%= es_template_config['node.data'] %> +<% end -%> + #################################### Index ####################################