From e55fe0695a7cf2e556d6a9b542fc5d7a1e4cb528 Mon Sep 17 00:00:00 2001 From: Will Farrington Date: Sat, 19 Oct 2013 21:07:03 -0700 Subject: [PATCH 1/8] initial spike at major refactoring --- files/brews/elasticsearch.rb | 6 +- manifests/config.pp | 51 ++- manifests/init.pp | 58 +--- manifests/package.pp | 21 ++ manifests/params.pp | 33 ++ manifests/service.pp | 19 ++ templates/dev.elasticsearch.plist.erb | 14 +- templates/elasticsearch.yml.erb | 431 +++----------------------- templates/env.sh.erb | 2 +- 9 files changed, 178 insertions(+), 457 deletions(-) create mode 100644 manifests/package.pp create mode 100644 manifests/params.pp create mode 100644 manifests/service.pp diff --git a/files/brews/elasticsearch.rb b/files/brews/elasticsearch.rb index 2913f00..58dc6e0 100644 --- a/files/brews/elasticsearch.rb +++ b/files/brews/elasticsearch.rb @@ -2,9 +2,9 @@ class Elasticsearch < Formula homepage 'http://www.elasticsearch.org' - url 'https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.3.tar.gz' - sha1 '24843192bee3afd19f5a958800e896153dbc3569' - version '0.90.3-boxen1' + url 'https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.5.tar.gz' + sha1 '8027a4ae1bef6876c7651b1590607c8ff6108820' + version '0.90.5-boxen1' def cluster_name "elasticsearch_#{ENV['USER']}" diff --git a/manifests/config.pp b/manifests/config.pp index 42802d3..4564094 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -1,18 +1,37 @@ -# Internal: Configure elasticsearch. -# -# Examples -# -# include elasticsearch::config -class elasticsearch::config { - require boxen::config +class elasticsearch::config( + $ensure = $elasticsearch::params::ensure, + $cluster = $elasticsearch::params::cluster, + $user = $elasticsearch::params::user, + $configdir = $elasticsearch::params::configdir, + $datadir = $elasticsearch::params::datadir, + $executable = $elasticsearch::params::executable, + $logdir = $elasticsearch::params::logdir, + $http_port = $elasticsearch::params::http_port, + $transport_port = $elasticsearch::params::transport_port, +) inherits elasticsearch::params { + + File { + owner => $user + } + + file { + [ + $configdir, + $datadir, + $logdir + ]: + ensure => directory ; + + "${configdir}/elasticsearch.yml": + content => template('elasticsearch/elasticsearch.yml.erb') ; + + '/Library/LaunchDaemons/dev.elasticsearch.plist': + content => template('elasticsearch/dev.elasticsearch.plist.erb'), + group => 'wheel', + owner => 'root' ; + + "${envdir}/elasticsearch.sh": + content => template('elasticsearch/env.sh.erb') ; + } - $cluster = "elasticsearch_boxen_${::boxen_user}" - $configdir = "${boxen::config::configdir}/elasticsearch" - $configfile = "${configdir}/elasticsearch.yml" - $datadir = "${boxen::config::datadir}/elasticsearch" - $executable = "${boxen::config::homebrewdir}/bin/elasticsearch" - $logdir = "${boxen::config::logdir}/elasticsearch" - $logfile = "${logdir}/console.log" - $port = 19200 - $transport = 19300 } diff --git a/manifests/init.pp b/manifests/init.pp index 5eac166..0c54e71 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -3,54 +3,28 @@ # Examples # # include elasticsearch -class elasticsearch { - require elasticsearch::config - include java - require homebrew - - file { [ - $elasticsearch::config::configdir, - $elasticsearch::config::datadir, - $elasticsearch::config::logdir - ]: - ensure => directory, - } - - file { $elasticsearch::config::configfile: - content => template('elasticsearch/elasticsearch.yml.erb'), - require => File[$elasticsearch::config::configdir], - notify => Service['dev.elasticsearch'], - } +class elasticsearch( + $ensure = $elasticsearch::params::ensure, + $version = $elasticsearch::params::version, + $package = $elasticsearch::params::package, +) inherits elasticsearch::params { - file { '/Library/LaunchDaemons/dev.elasticsearch.plist': - content => template('elasticsearch/dev.elasticsearch.plist.erb'), - group => 'wheel', - notify => Service['dev.elasticsearch'], - owner => 'root' - } - - homebrew::formula { 'elasticsearch': - before => Package['boxen/brews/elasticsearch'], - } + include java - package { 'boxen/brews/elasticsearch': - ensure => '0.90.3-boxen1', - notify => Service['dev.elasticsearch'], - require => Class['java'], + class { 'elasticsearch::config': + ensure => $ensure, } - service { 'dev.elasticsearch': - ensure => running, - require => Package['boxen/brews/elasticsearch'] + ~> + class { 'elasticsearch::package': + ensure => $ensure, + version => $version, + package => $package, } - service { 'com.boxen.elasticsearch': # replaced by dev.elasticsearch - before => Service['dev.elasticsearch'], - enable => false + ~> + class { 'elasticsearch::service': + ensure => $ensure, } - file { "${boxen::config::envdir}/elasticsearch.sh": - content => template('elasticsearch/env.sh.erb'), - require => File[$boxen::config::envdir] - } } diff --git a/manifests/package.pp b/manifests/package.pp new file mode 100644 index 0000000..de14f71 --- /dev/null +++ b/manifests/package.pp @@ -0,0 +1,21 @@ +class elasticsearch::package( + $ensure = $elasticsearch::params::ensure, + $version = $elasticsearch::params::version, + $package = $elasticsearch::params::package, +) inherits elasticsearch::params { + + $package_ensure = $ensure ? { + present => $version, + default => installed, + } + + homebrew::formula { 'elasticsearch': + ensure => $ensure + } + + -> + package { $package: + ensure => $package_ensure, + } + +} diff --git a/manifests/params.pp b/manifests/params.pp new file mode 100644 index 0000000..9f82709 --- /dev/null +++ b/manifests/params.pp @@ -0,0 +1,33 @@ +# Internal: Configure elasticsearch. + +class elasticsearch::params { + + case $::osfamily { + Darwin: { + require boxen::config + + $ensure = 'present' + $version = '0.90.5-boxen1' + $package = 'boxen/brews/elasticsearch' + + $cluster = "elasticsearch_boxen_${::boxen_user}" + + $user = $::boxen_user + + $configdir = "${boxen::config::configdir}/elasticsearch" + $datadir = "${boxen::config::datadir}/elasticsearch" + $executable = "${boxen::config::homebrewdir}/bin/elasticsearch" + $logdir = "${boxen::config::logdir}/elasticsearch" + $envdir = $boxen::config::envdir + + $logfile = "${logdir}/console.log" + $http_port = 19200 + $transport_port = 19300 + } + + default: { + fail("Unsupported operating system: ${::osfamily}") + } + } + +} diff --git a/manifests/service.pp b/manifests/service.pp new file mode 100644 index 0000000..a512ba9 --- /dev/null +++ b/manifests/service.pp @@ -0,0 +1,19 @@ +class elasticsearch::service( + $ensure = $elasticsearch::params::ensure, +) inherits elasticsearch::params { + + $service_ensure = $ensure ? { + present => running, + default => stopped, + } + + service { 'com.boxen.elasticsearch': + ensure => false, + } + + -> + service { 'dev.elasticsearch': + ensure => $service_ensure, + } + +} diff --git a/templates/dev.elasticsearch.plist.erb b/templates/dev.elasticsearch.plist.erb index 3fc4b8e..ad1d1a1 100644 --- a/templates/dev.elasticsearch.plist.erb +++ b/templates/dev.elasticsearch.plist.erb @@ -11,14 +11,14 @@ Full-text indexing and searching. Port - <%= scope.lookupvar "elasticsearch::config::port" %> + <%= @port %> ProgramArguments - <%= scope.lookupvar "elasticsearch::config::executable" %> + <%= @executable %> -f - -D es.config=<%= scope.lookupvar "elasticsearch::config::configfile" %> + -D es.config=<%= "#{@configdir}/elasticsearch.yml" %> RunAtLoad @@ -28,15 +28,15 @@ UserName - <%= scope.lookupvar "::boxen_user" %> + <%= @user %> WorkingDirectory - <%= scope.lookupvar "elasticsearch::config::datadir" %> + <%= @datadir %> StandardErrorPath - <%= scope.lookupvar "elasticsearch::config::logfile" %> + <%= "#{@logdir}/console.log" %> StandardOutPath - <%= scope.lookupvar "elasticsearch::config::logfile" %> + <%= "#{@logdir}/console.log" %> diff --git a/templates/elasticsearch.yml.erb b/templates/elasticsearch.yml.erb index 36238b7..4c82e7f 100644 --- a/templates/elasticsearch.yml.erb +++ b/templates/elasticsearch.yml.erb @@ -1,388 +1,43 @@ -##################### ElasticSearch Configuration Example ##################### - -# This file contains an overview of various configuration settings, -# targeted at operations staff. Application developers should -# consult the guide at . -# -# The installation procedure is covered at -# . -# -# ElasticSearch comes with reasonable defaults for most settings, -# so you can try it out without bothering with configuration. -# -# Most of the time, these defaults are just fine for running a production -# cluster. If you're fine-tuning your cluster, or wondering about the -# effect of certain configuration option, please _do ask_ on the -# mailing list or IRC channel [http://elasticsearch.org/community]. - -# Any element in the configuration can be replaced with environment variables -# by placing them in ${...} notation. For example: -# -# node.rack: ${RACK_ENV_VAR} - -# See -# for information on supported formats and syntax for the configuration file. - - -################################### Cluster ################################### - -# Cluster name identifies your cluster for auto-discovery. If you're running -# multiple clusters on the same network, make sure you're using unique names. -# -cluster.name: <%= scope.lookupvar "elasticsearch::config::cluster" %> - - -#################################### Node ##################################### - -# Node names are generated dynamically on startup, so you're relieved -# from configuring them manually. You can tie this node to a specific name: -# -# node.name: "Franz Kafka" - -# Every node can be configured to allow or deny being eligible as the master, -# and to allow or deny to store the data. -# -# Allow this node to be eligible as a master node (enabled by default): -# -# node.master: true -# -# Allow this node to store data (enabled by default): -# -# node.data: true - -# You can exploit these settings to design advanced cluster topologies. -# -# 1. You want this node to never become a master node, only to hold data. -# This will be the "workhorse" of your cluster. -# -# node.master: false -# node.data: true -# -# 2. You want this node to only serve as a master: to not store any data and -# to have free resources. This will be the "coordinator" of your cluster. -# -# node.master: true -# node.data: false -# -# 3. You want this node to be neither master nor data node, but -# to act as a "search load balancer" (fetching data from nodes, -# aggregating results, etc.) -# -# node.master: false -# node.data: false - -# Use the Cluster Health API [http://localhost:9200/_cluster/health], the -# Node Info API [http://localhost:9200/_cluster/nodes] or GUI tools -# such as and -# to inspect the cluster state. - -# A node can have generic attributes associated with it, which can later be used -# 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 - -# By default, multiple nodes are allowed to start from the same installation location -# to disable it, set the following: -# -node.max_local_storage_nodes: 1 - - -#################################### Index #################################### - -# You can set a number of options (such as shard/replica options, mapping -# or analyzer definitions, translog settings, ...) for indices globally, -# in this file. -# -# Note, that it makes more sense to configure index settings specifically for -# a certain index, either when creating it or by using the index templates API. -# -# See and -# -# for more information. - -# Set the number of shards (splits) of an index (5 by default): -# -# index.number_of_shards: 5 - -# Set the number of replicas (additional copies) of an index (1 by default): -# -# index.number_of_replicas: 1 - -# Note, that for development on a local machine, with small indices, it usually -# makes sense to "disable" the distributed features: -# -index.number_of_shards: 1 -index.number_of_replicas: 0 - -# These settings directly affect the performance of index and search operations -# in your cluster. Assuming you have enough machines to hold shards and -# replicas, the rule of thumb is: -# -# 1. Having more *shards* enhances the _indexing_ performance and allows to -# _distribute_ a big index across machines. -# 2. Having more *replicas* enhances the _search_ performance and improves the -# cluster _availability_. -# -# The "number_of_shards" is a one-time setting for an index. -# -# The "number_of_replicas" can be increased or decreased anytime, -# by using the Index Update Settings API. -# -# ElasticSearch takes care about load balancing, relocating, gathering the -# results from nodes, etc. Experiment with different settings to fine-tune -# your setup. - -# Use the Index Status API () to inspect -# the index status. - - -#################################### Paths #################################### - -# Path to directory containing configuration (this file and logging.yml): -# -path.conf: <%= scope.lookupvar "elasticsearch::config::configdir" %>/ - -# Path to directory where to store index data allocated for this node. -# -path.data: <%= scope.lookupvar "elasticsearch::config::datadir" %>/ -# -# Can optionally include more than one location, causing data to be striped across -# the locations (à la RAID 0) on a file level, favouring locations with most free -# space on creation. For example: -# -#path.data: /var/elasticsearch/ - -# Path to temporary files: -# -# path.work: /path/to/work - -# Path to log files: -# -path.logs: <%= scope.lookupvar "elasticsearch::config::logdir" %>/ - -# Path to where plugins are installed: -# -# path.plugins: /path/to/plugins - - -#################################### Plugin ################################### - -# If a plugin listed here is not installed for current node, the node will not start. -# -# plugin.mandatory: mapper-attachments,lang-groovy - - -################################### Memory #################################### - -# ElasticSearch performs poorly when JVM starts swapping: you should ensure that -# it _never_ swaps. -# -# Set this property to true to lock the memory: -# -# bootstrap.mlockall: 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 -# for ElasticSearch, leaving enough memory for the operating system itself. -# -# You should also make sure that the ElasticSearch process is allowed to lock -# the memory, eg. by using `ulimit -l unlimited`. - - -############################## Network And HTTP ############################### - -# ElasticSearch, by default, binds itself to the 0.0.0.0 address, and listens -# on port [9200-9300] for HTTP traffic and on port [9300-9400] for node-to-node -# communication. (the range means that if the port is busy, it will automatically -# try the next port). - -# Set the bind address specifically (IPv4 or IPv6): -# -# network.bind_host: 192.168.0.1 - -# Set the address other nodes will use to communicate with this node. If not -# set, it is automatically derived. It must point to an actual IP address. -# -# network.publish_host: 192.168.0.1 - -# Set both 'bind_host' and 'publish_host': -# -# network.host: 192.168.0.1 - -# Set a custom port for the node to node communication (9300 by default): -# -transport.tcp.port: <%= scope.lookupvar('elasticsearch::config::transport') %> - -# Enable compression for all communication between nodes (disabled by default): -# -# transport.tcp.compress: true - -# Set a custom port to listen for HTTP traffic: -# -http.port: <%= scope.lookupvar('elasticsearch::config::port') %> - -# Set a custom allowed content length: -# -# http.max_content_length: 100mb - -# Disable HTTP completely: -# -# http.enabled: false - -# This setting makes Netty stop being burning CPU for what can only be -# actual retardation. -# -network.tcp.blocking: true - -################################### Gateway ################################### - -# The gateway allows for persisting the cluster state between full cluster -# restarts. Every change to the state (such as adding an index) will be stored -# in the gateway, and when the cluster starts up for the first time, -# it will read its state from the gateway. - -# There are several types of gateway implementations. For more information, -# see . - -# The default gateway type is the "local" gateway (recommended): -# -# gateway.type: local - -# Settings below control how and when to start the initial recovery process on -# a full cluster restart (to reuse as much local data as possible when using shared -# gateway). - -# Allow recovery process after N nodes in a cluster are up: -# -# gateway.recover_after_nodes: 1 - -# Set the timeout to initiate the recovery process, once the N nodes -# from previous setting are up (accepts time value): -# -# gateway.recover_after_time: 5m - -# Set how many nodes are expected in this cluster. Once these N nodes -# are up (and recover_after_nodes is met), begin recovery process immediately -# (without waiting for recover_after_time to expire): -# -# gateway.expected_nodes: 2 - - -############################# Recovery Throttling ############################# - -# These settings allow to control the process of shards allocation between -# nodes during initial recovery, replica allocation, rebalancing, -# or when adding and removing nodes. - -# Set the number of concurrent recoveries happening on a node: -# -# 1. During the initial recovery -# -# cluster.routing.allocation.node_initial_primaries_recoveries: 4 -# -# 2. During adding/removing nodes, rebalancing, etc -# -# cluster.routing.allocation.node_concurrent_recoveries: 2 - -# Set to throttle throughput when recovering (eg. 100mb, by default unlimited): -# -# indices.recovery.max_size_per_sec: 0 - -# Set to limit the number of open concurrent streams when -# recovering a shard from a peer: -# -# indices.recovery.concurrent_streams: 5 - - -################################## Discovery ################################## - -# Discovery infrastructure ensures nodes can be found within a cluster -# and master node is elected. Multicast discovery is the default. - -# Set to ensure a node sees N other master eligible nodes to be considered -# operational within the cluster. Set this option to a higher value (2-4) -# for large clusters (>3 nodes): -# -# discovery.zen.minimum_master_nodes: 1 - -# 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 -# to minimize discovery failures: -# -# discovery.zen.ping.timeout: 3s - -# See -# 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. -# -# 1. Disable multicast discovery (enabled by default): -# -discovery.zen.ping.multicast.enabled: false - -# 2. Configure an initial list of master nodes in the cluster -# to perform discovery when new nodes (master or data) are started: -# -# discovery.zen.ping.unicast.hosts: ["host1", "host2:port", "host3[portX-portY]"] - -# EC2 discovery allows to use AWS EC2 API in order to perform discovery. -# -# You have to install the cloud-aws plugin for enabling the EC2 discovery. -# -# See -# for more information. -# -# See -# for a step-by-step tutorial. - - -################################## Actions ################################## - -# Sending a DELETE request to the based URL of the server will delete every -# index. This setting will disable that functionality since it is pretty -# dangerous. -# -# See -# for more information. -# -action.disable_delete_all_indices: true - -# Disable automatic index creation. -# -# Automatic index creation can include a pattern based white/black list, for -# example: +aaa*,-bbb*,+ccc*,-* (+ meaning allowed, and – meaning disallowed). -# -# See the "Automatic Index Creation" section -# for more -# information. -# -# action.auto_create_index: false - - -################################## Slow Log ################################## - -# Shard level query and fetch threshold logging. - -#index.search.slowlog.level: TRACE -#index.search.slowlog.threshold.query.warn: 10s -#index.search.slowlog.threshold.query.info: 5s -#index.search.slowlog.threshold.query.debug: 2s -#index.search.slowlog.threshold.query.trace: 500ms - -#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 - -################################## GC Logging ################################ - -#monitor.jvm.gc.ParNew.warn: 1000ms -#monitor.jvm.gc.ParNew.info: 700ms -#monitor.jvm.gc.ParNew.debug: 400ms - -#monitor.jvm.gc.ConcurrentMarkSweep.warn: 10s -#monitor.jvm.gc.ConcurrentMarkSweep.info: 5s -#monitor.jvm.gc.ConcurrentMarkSweep.debug: 2s +cluster: + name: <%= @cluster %> + +node: + name: boxen + max_local_storage_nodes: 1 + +index: + number_of_shards: 1 + number_of_replicas: 0 + +path: + conf: <%= @configdir %>/ + data: <%= @datadir %>/ + logs: <%= @logdir %>/ + +network: + bind_host: 127.0.0.1 + publish_host: 127.0.0.1 + tcp: + blocking: true + +transport: + tcp: + port: <%= @transport_port %> + +http: + port: <%= @http_port %> + max_content_length: 500mb + +gateway: + type: local + recover_after_nodes: 1 + expected_nodes: 1 + +discovery: + zen: + ping: + multicast: + enabled: false + unicast: + hosts: + - 127.0.0.1:<%= @transport_port %> diff --git a/templates/env.sh.erb b/templates/env.sh.erb index 1ecb9f4..4463149 100644 --- a/templates/env.sh.erb +++ b/templates/env.sh.erb @@ -1,2 +1,2 @@ -export BOXEN_ELASTICSEARCH_PORT=<%= scope.lookupvar('elasticsearch::config::port') %> +export BOXEN_ELASTICSEARCH_PORT=<%= @port %> export BOXEN_ELASTICSEARCH_URL="http://localhost:${BOXEN_ELASTICSEARCH_PORT}/" From 43afd4d77814d84fc7f4dca3b41ab5cbcfab552c Mon Sep 17 00:00:00 2001 From: Will Farrington Date: Wed, 30 Oct 2013 10:00:06 -0700 Subject: [PATCH 2/8] SPIKE --- manifests/config.pp | 15 +++++++++--- manifests/init.pp | 42 ++++++++++++++++++++++++++------- manifests/package.pp | 6 ++--- manifests/params.pp | 10 ++++---- manifests/service.pp | 7 ++++-- templates/elasticsearch.yml.erb | 6 ++--- templates/env.sh.erb | 3 ++- 7 files changed, 63 insertions(+), 26 deletions(-) diff --git a/manifests/config.pp b/manifests/config.pp index 4564094..9a20888 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -6,10 +6,16 @@ $datadir = $elasticsearch::params::datadir, $executable = $elasticsearch::params::executable, $logdir = $elasticsearch::params::logdir, + $host = $elasticsearch::params::host, $http_port = $elasticsearch::params::http_port, $transport_port = $elasticsearch::params::transport_port, ) inherits elasticsearch::params { + $dir_ensure = $ensure ? { + present => directory, + default => absent, + } + File { owner => $user } @@ -20,7 +26,7 @@ $datadir, $logdir ]: - ensure => directory ; + ensure => $dir_ensure ; "${configdir}/elasticsearch.yml": content => template('elasticsearch/elasticsearch.yml.erb') ; @@ -29,9 +35,12 @@ content => template('elasticsearch/dev.elasticsearch.plist.erb'), group => 'wheel', owner => 'root' ; + } - "${envdir}/elasticsearch.sh": + if $::operatingsystem == 'Darwin' { + include boxen::config + + "${boxen::config::envdir}/elasticsearch.sh": content => template('elasticsearch/env.sh.erb') ; } - } diff --git a/manifests/init.pp b/manifests/init.pp index 0c54e71..ef01f7a 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -4,27 +4,53 @@ # # include elasticsearch class elasticsearch( - $ensure = $elasticsearch::params::ensure, - $version = $elasticsearch::params::version, - $package = $elasticsearch::params::package, + $ensure = $elasticsearch::params::ensure, + + $version = $elasticsearch::params::version, + $package = $elasticsearch::params::package, + + $cluster = $elasticsearch::params::cluster, + $user = $elasticsearch::params::user, + $configdir = $elasticsearch::params::configdir, + $datadir = $elasticsearch::params::datadir, + $executable = $elasticsearch::params::executable, + $logdir = $elasticsearch::params::logdir, + $host = $elasticsearch::params::host, + $http_port = $elasticsearch::params::http_port, + $transport_port = $elasticsearch::params::transport_port, + + $enable = $elasticsearch::params::enable, ) inherits elasticsearch::params { include java - class { 'elasticsearch::config': - ensure => $ensure, - } - - ~> class { 'elasticsearch::package': ensure => $ensure, + version => $version, package => $package, } + ~> + class { 'elasticsearch::config': + ensure => $ensure, + + cluster => $cluster, + user => $user, + configdir => $configdir, + datadir => $datadir, + executable => $executable, + logdir => $logdir, + host => $host, + http_port => $http_port, + transport_port => $transport_port, + } + ~> class { 'elasticsearch::service': ensure => $ensure, + + enable => $enable, } } diff --git a/manifests/package.pp b/manifests/package.pp index de14f71..8f4489a 100644 --- a/manifests/package.pp +++ b/manifests/package.pp @@ -3,15 +3,13 @@ $version = $elasticsearch::params::version, $package = $elasticsearch::params::package, ) inherits elasticsearch::params { - + $package_ensure = $ensure ? { present => $version, default => installed, } - homebrew::formula { 'elasticsearch': - ensure => $ensure - } + homebrew::formula { 'elasticsearch': } -> package { $package: diff --git a/manifests/params.pp b/manifests/params.pp index 9f82709..8de7a94 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -4,25 +4,25 @@ case $::osfamily { Darwin: { - require boxen::config + include boxen::config $ensure = 'present' + $version = '0.90.5-boxen1' $package = 'boxen/brews/elasticsearch' $cluster = "elasticsearch_boxen_${::boxen_user}" - $user = $::boxen_user - $configdir = "${boxen::config::configdir}/elasticsearch" $datadir = "${boxen::config::datadir}/elasticsearch" $executable = "${boxen::config::homebrewdir}/bin/elasticsearch" $logdir = "${boxen::config::logdir}/elasticsearch" - $envdir = $boxen::config::envdir - $logfile = "${logdir}/console.log" + $host = '127.0.0.1' $http_port = 19200 $transport_port = 19300 + + $enable = true } default: { diff --git a/manifests/service.pp b/manifests/service.pp index a512ba9..e75c948 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -1,5 +1,6 @@ class elasticsearch::service( $ensure = $elasticsearch::params::ensure, + $enable = $elasticsearch::params::enable, ) inherits elasticsearch::params { $service_ensure = $ensure ? { @@ -8,12 +9,14 @@ } service { 'com.boxen.elasticsearch': - ensure => false, + ensure => stopped, + enable => false, } -> service { 'dev.elasticsearch': - ensure => $service_ensure, + ensure => $service_ensure, + enable => $enable, } } diff --git a/templates/elasticsearch.yml.erb b/templates/elasticsearch.yml.erb index 4c82e7f..f5436f5 100644 --- a/templates/elasticsearch.yml.erb +++ b/templates/elasticsearch.yml.erb @@ -15,8 +15,8 @@ path: logs: <%= @logdir %>/ network: - bind_host: 127.0.0.1 - publish_host: 127.0.0.1 + bind_host: <%= @host %> + publish_host: <%= @host %> tcp: blocking: true @@ -40,4 +40,4 @@ discovery: enabled: false unicast: hosts: - - 127.0.0.1:<%= @transport_port %> + - <%= @host %>:<%= @transport_port %> diff --git a/templates/env.sh.erb b/templates/env.sh.erb index 4463149..20643b0 100644 --- a/templates/env.sh.erb +++ b/templates/env.sh.erb @@ -1,2 +1,3 @@ +export BOXEN_ELASTICSEARCH_HOST=<%= @host %> export BOXEN_ELASTICSEARCH_PORT=<%= @port %> -export BOXEN_ELASTICSEARCH_URL="http://localhost:${BOXEN_ELASTICSEARCH_PORT}/" +export BOXEN_ELASTICSEARCH_URL="http://${BOXEN_ELASTICSEARCH_HOST}:${BOXEN_ELASTICSEARCH_PORT}/" From a33aefffffa9ec5d37abd66b1fc130bf160521fd Mon Sep 17 00:00:00 2001 From: Will Farrington Date: Wed, 30 Oct 2013 10:26:50 -0700 Subject: [PATCH 3/8] derp --- manifests/config.pp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/manifests/config.pp b/manifests/config.pp index 9a20888..ce26c05 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -17,7 +17,8 @@ } File { - owner => $user + ensure => $ensure, + owner => $user } file { @@ -40,7 +41,8 @@ if $::operatingsystem == 'Darwin' { include boxen::config - "${boxen::config::envdir}/elasticsearch.sh": - content => template('elasticsearch/env.sh.erb') ; + file { "${boxen::config::envdir}/elasticsearch.sh": + content => template('elasticsearch/env.sh.erb') + } } } From 144915c7ae1b9e9269d466ed9a7ee945c207051c Mon Sep 17 00:00:00 2001 From: Will Farrington Date: Wed, 30 Oct 2013 10:30:10 -0700 Subject: [PATCH 4/8] Fix plist --- templates/dev.elasticsearch.plist.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/dev.elasticsearch.plist.erb b/templates/dev.elasticsearch.plist.erb index ad1d1a1..72bb444 100644 --- a/templates/dev.elasticsearch.plist.erb +++ b/templates/dev.elasticsearch.plist.erb @@ -11,7 +11,7 @@ Full-text indexing and searching. Port - <%= @port %> + <%= @http_port %> ProgramArguments From bb3a2f11cec257deef60ac3692870264437bd728 Mon Sep 17 00:00:00 2001 From: Will Farrington Date: Wed, 30 Oct 2013 10:32:32 -0700 Subject: [PATCH 5/8] Fix the shell config loader --- templates/env.sh.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/env.sh.erb b/templates/env.sh.erb index 20643b0..3f5c4ae 100644 --- a/templates/env.sh.erb +++ b/templates/env.sh.erb @@ -1,3 +1,3 @@ export BOXEN_ELASTICSEARCH_HOST=<%= @host %> -export BOXEN_ELASTICSEARCH_PORT=<%= @port %> +export BOXEN_ELASTICSEARCH_PORT=<%= @http_port %> export BOXEN_ELASTICSEARCH_URL="http://${BOXEN_ELASTICSEARCH_HOST}:${BOXEN_ELASTICSEARCH_PORT}/" From 15b361559326b700069d78b9ba9fe5358e5c7bd3 Mon Sep 17 00:00:00 2001 From: Will Farrington Date: Wed, 30 Oct 2013 10:57:15 -0700 Subject: [PATCH 6/8] Fixes and specs --- manifests/config.pp | 8 +++- manifests/package.pp | 5 ++- spec/classes/elasticsearch_config_spec.rb | 18 +++++++- spec/classes/elasticsearch_package_spec.rb | 11 +++++ spec/classes/elasticsearch_service_spec.rb | 13 ++++++ spec/classes/elasticsearch_spec.rb | 49 ++-------------------- spec/fixtures/Puppetfile | 2 +- spec/spec_helper.rb | 6 ++- 8 files changed, 60 insertions(+), 52 deletions(-) create mode 100644 spec/classes/elasticsearch_package_spec.rb create mode 100644 spec/classes/elasticsearch_service_spec.rb diff --git a/manifests/config.pp b/manifests/config.pp index ce26c05..bfcc051 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -39,10 +39,16 @@ } if $::operatingsystem == 'Darwin' { + boxen::env_script { 'elasticsearch': + ensure => $ensure, + content => template('elasticsearch/env.sh.erb'), + priority => 'lower', + } + include boxen::config file { "${boxen::config::envdir}/elasticsearch.sh": - content => template('elasticsearch/env.sh.erb') + ensure => absent, } } } diff --git a/manifests/package.pp b/manifests/package.pp index 8f4489a..759ab8a 100644 --- a/manifests/package.pp +++ b/manifests/package.pp @@ -9,9 +9,10 @@ default => installed, } - homebrew::formula { 'elasticsearch': } + if $::operatingsystem == 'Darwin' { + homebrew::formula { 'elasticsearch': } + } - -> package { $package: ensure => $package_ensure, } diff --git a/spec/classes/elasticsearch_config_spec.rb b/spec/classes/elasticsearch_config_spec.rb index 36a38d7..98ef6fb 100644 --- a/spec/classes/elasticsearch_config_spec.rb +++ b/spec/classes/elasticsearch_config_spec.rb @@ -4,6 +4,22 @@ let(:facts) { default_test_facts } it do - should include_class('boxen::config') + %w(log config data).each do |d| + should contain_file("/test/boxen/#{d}/elasticsearch").with_ensure(:directory) + end + + should contain_file("/test/boxen/config/elasticsearch/elasticsearch.yml") + + should contain_file("/Library/LaunchDaemons/dev.elasticsearch.plist").with({ + :group => "wheel", + :owner => "root", + }) + + should contain_boxen__env_script("elasticsearch").with({ + :ensure => :present, + :priority => "lower", + }) + + should contain_file("/test/boxen/env.d/elasticsearch.sh").with_ensure(:absent) end end diff --git a/spec/classes/elasticsearch_package_spec.rb b/spec/classes/elasticsearch_package_spec.rb new file mode 100644 index 0000000..9e96ec9 --- /dev/null +++ b/spec/classes/elasticsearch_package_spec.rb @@ -0,0 +1,11 @@ +require "spec_helper" + +describe "elasticsearch::package" do + let(:facts) { default_test_facts } + + it do + should contain_homebrew__formula("elasticsearch") + + should contain_package("boxen/brews/elasticsearch").with_ensure("0.90.5-boxen1") + end +end diff --git a/spec/classes/elasticsearch_service_spec.rb b/spec/classes/elasticsearch_service_spec.rb new file mode 100644 index 0000000..16ce255 --- /dev/null +++ b/spec/classes/elasticsearch_service_spec.rb @@ -0,0 +1,13 @@ +require "spec_helper" + +describe "elasticsearch::service" do + let(:facts) { default_test_facts } + + it do + should contain_service("com.boxen.elasticsearch").with_ensure(:stopped) + should contain_service("dev.elasticsearch").with({ + :ensure => :running, + :enable => true, + }) + end +end diff --git a/spec/classes/elasticsearch_spec.rb b/spec/classes/elasticsearch_spec.rb index 9f7890c..fdd1a28 100644 --- a/spec/classes/elasticsearch_spec.rb +++ b/spec/classes/elasticsearch_spec.rb @@ -4,51 +4,10 @@ let(:facts) { default_test_facts } it do - should include_class('elasticsearch::config') - should include_class('homebrew') - should include_class('java') + should include_class("elasticsearch::config") + should include_class("elasticsearch::package") + should include_class("elasticsearch::service") - should contain_homebrew__formula('elasticsearch'). - with_before('Package[boxen/brews/elasticsearch]') - - ['config', 'data', 'log'].each do |dir| - should contain_file("/test/boxen/#{dir}/elasticsearch").with({ - :ensure => 'directory' - }) - end - - should contain_file("/test/boxen/config/elasticsearch/elasticsearch.yml").with({ - :content => File.read('spec/fixtures/elasticsearch.yml'), - :require => "File[/test/boxen/config/elasticsearch]", - :notify => 'Service[dev.elasticsearch]' - }) - - should contain_file('/Library/LaunchDaemons/dev.elasticsearch.plist').with({ - :content => File.read('spec/fixtures/dev.elasticsearch.plist'), - :group => 'wheel', - :notify => 'Service[dev.elasticsearch]', - :owner => 'root', - }) - - should contain_package('boxen/brews/elasticsearch').with({ - :ensure => '0.90.3-boxen1', - :notify => 'Service[dev.elasticsearch]', - :require => 'Class[Java]' - }) - - should contain_service('dev.elasticsearch').with({ - :ensure => 'running', - :require => 'Package[boxen/brews/elasticsearch]', - }) - - should contain_service('com.boxen.elasticsearch').with({ - :ensure => nil, - :before => 'Service[dev.elasticsearch]', - }) - - should contain_file('/test/boxen/env.d/elasticsearch.sh').with({ - :content => File.read('spec/fixtures/elasticsearch.sh'), - :require => 'File[/test/boxen/env.d]' - }) + should include_class("java") end end diff --git a/spec/fixtures/Puppetfile b/spec/fixtures/Puppetfile index 079c521..fedb278 100644 --- a/spec/fixtures/Puppetfile +++ b/spec/fixtures/Puppetfile @@ -1,4 +1,4 @@ -mod 'boxen', '3.0.2', :github_tarball => 'boxen/puppet-boxen' +mod 'boxen', '3.3.3', :github_tarball => 'boxen/puppet-boxen' mod 'homebrew', '1.4.1', :github_tarball => 'boxen/puppet-homebrew' mod 'repository', '2.2.0', :github_tarball => 'boxen/puppet-repository' mod 'java', '1.1.2', :github_tarball => 'boxen/puppet-java' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index d40a1c2..a13ecd1 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -9,7 +9,9 @@ def default_test_facts { - :boxen_home => "/test/boxen", - :boxen_user => "testuser" + :boxen_home => "/test/boxen", + :boxen_user => "testuser", + :operatingsystem => "Darwin", + :osfamily => "Darwin", } end From 7dbb9556a51bdd66a62015fc0cd4d6c19681db6a Mon Sep 17 00:00:00 2001 From: Will Farrington Date: Wed, 30 Oct 2013 11:03:14 -0700 Subject: [PATCH 7/8] lint and talk about hiera in readme --- README.md | 5 ++++- manifests/config.pp | 3 +++ manifests/init.pp | 2 +- manifests/package.pp | 2 ++ manifests/service.pp | 2 ++ 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 32f1c95..2e313c1 100644 --- a/README.md +++ b/README.md @@ -12,9 +12,12 @@ RESTful search engine. The `BOXEN_ELASTICSEARCH_PORT` and include elasticsearch ``` +This module supports data bindings via hiera. +See the parameters to the elasticsearch class for overrideable values. + ## Required Puppet Modules -* `boxen` +* `boxen` >= 3.3.3 * `homebrew` * `repository` * `java` diff --git a/manifests/config.pp b/manifests/config.pp index bfcc051..d4bb057 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -1,3 +1,6 @@ +# Internal: Manages the elasticsearch configuration files +# + class elasticsearch::config( $ensure = $elasticsearch::params::ensure, $cluster = $elasticsearch::params::cluster, diff --git a/manifests/init.pp b/manifests/init.pp index ef01f7a..ffd3e3f 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -33,7 +33,7 @@ ~> class { 'elasticsearch::config': - ensure => $ensure, + ensure => $ensure, cluster => $cluster, user => $user, diff --git a/manifests/package.pp b/manifests/package.pp index 759ab8a..bbeb228 100644 --- a/manifests/package.pp +++ b/manifests/package.pp @@ -1,3 +1,5 @@ +# Internal: Manages the elasticsearch package +# class elasticsearch::package( $ensure = $elasticsearch::params::ensure, $version = $elasticsearch::params::version, diff --git a/manifests/service.pp b/manifests/service.pp index e75c948..7746c28 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -1,3 +1,5 @@ +# Internal: Manages the elasticsearch service +# class elasticsearch::service( $ensure = $elasticsearch::params::ensure, $enable = $elasticsearch::params::enable, From b5a90931fc9544fcb5ce8ddaee6a933df62560a7 Mon Sep 17 00:00:00 2001 From: Will Farrington Date: Wed, 30 Oct 2013 11:22:53 -0700 Subject: [PATCH 8/8] cleanup --- spec/fixtures/dev.elasticsearch.plist | 42 --- spec/fixtures/elasticsearch.sh | 2 - spec/fixtures/elasticsearch.yml | 388 -------------------------- 3 files changed, 432 deletions(-) delete mode 100644 spec/fixtures/dev.elasticsearch.plist delete mode 100644 spec/fixtures/elasticsearch.sh delete mode 100644 spec/fixtures/elasticsearch.yml diff --git a/spec/fixtures/dev.elasticsearch.plist b/spec/fixtures/dev.elasticsearch.plist deleted file mode 100644 index d50c7aa..0000000 --- a/spec/fixtures/dev.elasticsearch.plist +++ /dev/null @@ -1,42 +0,0 @@ - - - - - Label - dev.elasticsearch - - Boxen - - Description - Full-text indexing and searching. - - Port - 19200 - - - ProgramArguments - - /test/boxen/homebrew/bin/elasticsearch - -f - -D es.config=/test/boxen/config/elasticsearch/elasticsearch.yml - - - RunAtLoad - - - KeepAlive - - - UserName - testuser - - WorkingDirectory - /test/boxen/data/elasticsearch - - StandardErrorPath - /test/boxen/log/elasticsearch/console.log - - StandardOutPath - /test/boxen/log/elasticsearch/console.log - - diff --git a/spec/fixtures/elasticsearch.sh b/spec/fixtures/elasticsearch.sh deleted file mode 100644 index 117da98..0000000 --- a/spec/fixtures/elasticsearch.sh +++ /dev/null @@ -1,2 +0,0 @@ -export BOXEN_ELASTICSEARCH_PORT=19200 -export BOXEN_ELASTICSEARCH_URL="http://localhost:${BOXEN_ELASTICSEARCH_PORT}/" diff --git a/spec/fixtures/elasticsearch.yml b/spec/fixtures/elasticsearch.yml deleted file mode 100644 index be33df7..0000000 --- a/spec/fixtures/elasticsearch.yml +++ /dev/null @@ -1,388 +0,0 @@ -##################### ElasticSearch Configuration Example ##################### - -# This file contains an overview of various configuration settings, -# targeted at operations staff. Application developers should -# consult the guide at . -# -# The installation procedure is covered at -# . -# -# ElasticSearch comes with reasonable defaults for most settings, -# so you can try it out without bothering with configuration. -# -# Most of the time, these defaults are just fine for running a production -# cluster. If you're fine-tuning your cluster, or wondering about the -# effect of certain configuration option, please _do ask_ on the -# mailing list or IRC channel [http://elasticsearch.org/community]. - -# Any element in the configuration can be replaced with environment variables -# by placing them in ${...} notation. For example: -# -# node.rack: ${RACK_ENV_VAR} - -# See -# for information on supported formats and syntax for the configuration file. - - -################################### Cluster ################################### - -# Cluster name identifies your cluster for auto-discovery. If you're running -# multiple clusters on the same network, make sure you're using unique names. -# -cluster.name: elasticsearch_boxen_testuser - - -#################################### Node ##################################### - -# Node names are generated dynamically on startup, so you're relieved -# from configuring them manually. You can tie this node to a specific name: -# -# node.name: "Franz Kafka" - -# Every node can be configured to allow or deny being eligible as the master, -# and to allow or deny to store the data. -# -# Allow this node to be eligible as a master node (enabled by default): -# -# node.master: true -# -# Allow this node to store data (enabled by default): -# -# node.data: true - -# You can exploit these settings to design advanced cluster topologies. -# -# 1. You want this node to never become a master node, only to hold data. -# This will be the "workhorse" of your cluster. -# -# node.master: false -# node.data: true -# -# 2. You want this node to only serve as a master: to not store any data and -# to have free resources. This will be the "coordinator" of your cluster. -# -# node.master: true -# node.data: false -# -# 3. You want this node to be neither master nor data node, but -# to act as a "search load balancer" (fetching data from nodes, -# aggregating results, etc.) -# -# node.master: false -# node.data: false - -# Use the Cluster Health API [http://localhost:9200/_cluster/health], the -# Node Info API [http://localhost:9200/_cluster/nodes] or GUI tools -# such as and -# to inspect the cluster state. - -# A node can have generic attributes associated with it, which can later be used -# 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 - -# By default, multiple nodes are allowed to start from the same installation location -# to disable it, set the following: -# -node.max_local_storage_nodes: 1 - - -#################################### Index #################################### - -# You can set a number of options (such as shard/replica options, mapping -# or analyzer definitions, translog settings, ...) for indices globally, -# in this file. -# -# Note, that it makes more sense to configure index settings specifically for -# a certain index, either when creating it or by using the index templates API. -# -# See and -# -# for more information. - -# Set the number of shards (splits) of an index (5 by default): -# -# index.number_of_shards: 5 - -# Set the number of replicas (additional copies) of an index (1 by default): -# -# index.number_of_replicas: 1 - -# Note, that for development on a local machine, with small indices, it usually -# makes sense to "disable" the distributed features: -# -index.number_of_shards: 1 -index.number_of_replicas: 0 - -# These settings directly affect the performance of index and search operations -# in your cluster. Assuming you have enough machines to hold shards and -# replicas, the rule of thumb is: -# -# 1. Having more *shards* enhances the _indexing_ performance and allows to -# _distribute_ a big index across machines. -# 2. Having more *replicas* enhances the _search_ performance and improves the -# cluster _availability_. -# -# The "number_of_shards" is a one-time setting for an index. -# -# The "number_of_replicas" can be increased or decreased anytime, -# by using the Index Update Settings API. -# -# ElasticSearch takes care about load balancing, relocating, gathering the -# results from nodes, etc. Experiment with different settings to fine-tune -# your setup. - -# Use the Index Status API () to inspect -# the index status. - - -#################################### Paths #################################### - -# Path to directory containing configuration (this file and logging.yml): -# -path.conf: /test/boxen/config/elasticsearch/ - -# Path to directory where to store index data allocated for this node. -# -path.data: /test/boxen/data/elasticsearch/ -# -# Can optionally include more than one location, causing data to be striped across -# the locations (à la RAID 0) on a file level, favouring locations with most free -# space on creation. For example: -# -#path.data: /var/elasticsearch/ - -# Path to temporary files: -# -# path.work: /path/to/work - -# Path to log files: -# -path.logs: /test/boxen/log/elasticsearch/ - -# Path to where plugins are installed: -# -# path.plugins: /path/to/plugins - - -#################################### Plugin ################################### - -# If a plugin listed here is not installed for current node, the node will not start. -# -# plugin.mandatory: mapper-attachments,lang-groovy - - -################################### Memory #################################### - -# ElasticSearch performs poorly when JVM starts swapping: you should ensure that -# it _never_ swaps. -# -# Set this property to true to lock the memory: -# -# bootstrap.mlockall: 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 -# for ElasticSearch, leaving enough memory for the operating system itself. -# -# You should also make sure that the ElasticSearch process is allowed to lock -# the memory, eg. by using `ulimit -l unlimited`. - - -############################## Network And HTTP ############################### - -# ElasticSearch, by default, binds itself to the 0.0.0.0 address, and listens -# on port [9200-9300] for HTTP traffic and on port [9300-9400] for node-to-node -# communication. (the range means that if the port is busy, it will automatically -# try the next port). - -# Set the bind address specifically (IPv4 or IPv6): -# -# network.bind_host: 192.168.0.1 - -# Set the address other nodes will use to communicate with this node. If not -# set, it is automatically derived. It must point to an actual IP address. -# -# network.publish_host: 192.168.0.1 - -# Set both 'bind_host' and 'publish_host': -# -# network.host: 192.168.0.1 - -# Set a custom port for the node to node communication (9300 by default): -# -transport.tcp.port: 19300 - -# Enable compression for all communication between nodes (disabled by default): -# -# transport.tcp.compress: true - -# Set a custom port to listen for HTTP traffic: -# -http.port: 19200 - -# Set a custom allowed content length: -# -# http.max_content_length: 100mb - -# Disable HTTP completely: -# -# http.enabled: false - -# This setting makes Netty stop being burning CPU for what can only be -# actual retardation. -# -network.tcp.blocking: true - -################################### Gateway ################################### - -# The gateway allows for persisting the cluster state between full cluster -# restarts. Every change to the state (such as adding an index) will be stored -# in the gateway, and when the cluster starts up for the first time, -# it will read its state from the gateway. - -# There are several types of gateway implementations. For more information, -# see . - -# The default gateway type is the "local" gateway (recommended): -# -# gateway.type: local - -# Settings below control how and when to start the initial recovery process on -# a full cluster restart (to reuse as much local data as possible when using shared -# gateway). - -# Allow recovery process after N nodes in a cluster are up: -# -# gateway.recover_after_nodes: 1 - -# Set the timeout to initiate the recovery process, once the N nodes -# from previous setting are up (accepts time value): -# -# gateway.recover_after_time: 5m - -# Set how many nodes are expected in this cluster. Once these N nodes -# are up (and recover_after_nodes is met), begin recovery process immediately -# (without waiting for recover_after_time to expire): -# -# gateway.expected_nodes: 2 - - -############################# Recovery Throttling ############################# - -# These settings allow to control the process of shards allocation between -# nodes during initial recovery, replica allocation, rebalancing, -# or when adding and removing nodes. - -# Set the number of concurrent recoveries happening on a node: -# -# 1. During the initial recovery -# -# cluster.routing.allocation.node_initial_primaries_recoveries: 4 -# -# 2. During adding/removing nodes, rebalancing, etc -# -# cluster.routing.allocation.node_concurrent_recoveries: 2 - -# Set to throttle throughput when recovering (eg. 100mb, by default unlimited): -# -# indices.recovery.max_size_per_sec: 0 - -# Set to limit the number of open concurrent streams when -# recovering a shard from a peer: -# -# indices.recovery.concurrent_streams: 5 - - -################################## Discovery ################################## - -# Discovery infrastructure ensures nodes can be found within a cluster -# and master node is elected. Multicast discovery is the default. - -# Set to ensure a node sees N other master eligible nodes to be considered -# operational within the cluster. Set this option to a higher value (2-4) -# for large clusters (>3 nodes): -# -# discovery.zen.minimum_master_nodes: 1 - -# 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 -# to minimize discovery failures: -# -# discovery.zen.ping.timeout: 3s - -# See -# 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. -# -# 1. Disable multicast discovery (enabled by default): -# -discovery.zen.ping.multicast.enabled: false - -# 2. Configure an initial list of master nodes in the cluster -# to perform discovery when new nodes (master or data) are started: -# -# discovery.zen.ping.unicast.hosts: ["host1", "host2:port", "host3[portX-portY]"] - -# EC2 discovery allows to use AWS EC2 API in order to perform discovery. -# -# You have to install the cloud-aws plugin for enabling the EC2 discovery. -# -# See -# for more information. -# -# See -# for a step-by-step tutorial. - - -################################## Actions ################################## - -# Sending a DELETE request to the based URL of the server will delete every -# index. This setting will disable that functionality since it is pretty -# dangerous. -# -# See -# for more information. -# -action.disable_delete_all_indices: true - -# Disable automatic index creation. -# -# Automatic index creation can include a pattern based white/black list, for -# example: +aaa*,-bbb*,+ccc*,-* (+ meaning allowed, and – meaning disallowed). -# -# See the "Automatic Index Creation" section -# for more -# information. -# -# action.auto_create_index: false - - -################################## Slow Log ################################## - -# Shard level query and fetch threshold logging. - -#index.search.slowlog.level: TRACE -#index.search.slowlog.threshold.query.warn: 10s -#index.search.slowlog.threshold.query.info: 5s -#index.search.slowlog.threshold.query.debug: 2s -#index.search.slowlog.threshold.query.trace: 500ms - -#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 - -################################## GC Logging ################################ - -#monitor.jvm.gc.ParNew.warn: 1000ms -#monitor.jvm.gc.ParNew.info: 700ms -#monitor.jvm.gc.ParNew.debug: 400ms - -#monitor.jvm.gc.ConcurrentMarkSweep.warn: 10s -#monitor.jvm.gc.ConcurrentMarkSweep.info: 5s -#monitor.jvm.gc.ConcurrentMarkSweep.debug: 2s