Giter Club home page Giter Club logo

elasticsearch-formula's Introduction

Elasticsearch

Formula to install and configure Elasticsearch. Supports 2.x and 5.x.

Available states

elasticsearch -----------

Installs, configures and runs the Elasticsearch service.

elasticsearch.config

Configures Elasticsearch. Custom options can be specified via custom_options and are rendered as yaml in the elasticsearch config.

elasticsearch.pkg

Installs Elasticsearch.

elasticsearch.repo

Adds the Elasticsearch pkg repo.

elasticsearch.service

Manages the Elasticsearch service.

elasticsearch.sysconfig

Configures defaults/sysconfig env vars for the Elasticsearch service.

elasticsearch.plugins

Allows configuration of elasticsearch plugins.

Notes

  • Pillar elasticsearch:config:custom_options has been removed. Use elasticsearch:config to set any configuration.

Testing

Testing is done with Test Kitchen for machine setup and testinfra for integration tests.

Requirements

  • Python
  • Ruby
  • Docker
pip install -r requirements.txt
gem install bundler
bundle install
bundle exec kitchen test

elasticsearch-formula's People

Contributors

aboe76 avatar arthurzenika avatar beezz avatar blbradley avatar cboltz avatar cmclaughlin avatar danygielow avatar kpostrup avatar lloydarmstrong avatar martinhoefling avatar myii avatar myoung34 avatar ninapavlich avatar wwentland avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

elasticsearch-formula's Issues

Setting for discovery.zen.ping.unicast.hosts does not work

The example.pillar shows that it is that way:
discovery.zen.ping.unicast.hosts: ["host1", "host2"]

But then it will be rendered as:

discovery.zen.ping.unicast.hosts:
- host1
- host2

The cluster will work afterwards but only because "discovery.zen.ping.unicast.hosts:" is actually empty and will use multicast for discovery which has its own problems according to the elasticsearch-documentation.

tests fail for 5.0.1

States execute, but service stops. I think this is due to a new check in 5.0.1.

Relevant log:

[2016-11-27T18:15:38,231][WARN ][o.e.b.BootstrapCheck     ] [I9Z5Rn8] max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

We may need a state that sets this.

[BUG] path.data does not support lists

Elasticsearch docs support multiple data paths.

The path.data settings can be set to multiple paths, in which case all paths will be used to store data (although the files belonging to a single shard will all be stored on the same data path):

path:
  data:
    - /mnt/elasticsearch_1
    - /mnt/elasticsearch_2
    - /mnt/elasticsearch_3

See: https://www.elastic.co/guide/en/elasticsearch/reference/master/path-settings.html

Attempting to use a list produces the following output:

[CRITICAL] Rendering SLS 'base:elasticsearch.config' failed: while constructing a mapping
  in "<unicode string>", line 1, column 1:
    include:
    ^
found unacceptable key [ScalarNode(tag='tag:yaml.org,2002:str', value='/usr/shar
  in "<unicode string>", line 17, column 1:
    ['/usr/share/elasticsearch/data' ... 
    ^
local:
    Data failed to compile:
----------
    Rendering SLS 'base:elasticsearch.config' failed: while constructing a mappi
  in "<unicode string>", line 1, column 1:
    include:
    ^
found unacceptable key [ScalarNode(tag='tag:yaml.org,2002:str', value='/usr/shar
  in "<unicode string>", line 17, column 1:
    ['/usr/share/elasticsearch/data' ... 
    ^

Elasticsearch 5.4.0 installation fails on Ubuntu in an LCD container

Hi

When installing ES 5.4.0 on Ubuntu in an LXD container you need to install with the following command

export ES_SKIP_SET_KERNEL_PARAMETERS=true; apt install elasticsearch

The ES_SKIP_SET_KERNEL_PARAMETERS=true env variable is necesarl because there are kernel parameters that are tuned on installation that are not available to the container and installation fails.

ElasticSearch 6.3 requires keystore file to exist

ES 6.3 won't start without a keystore file existing. On many systems the user/group/context that ES runs in does not, and should not, have permission to create files in /etc/elasticsearch. Formula should create a default keystore in default location if one does not exist.

Jul 20 14:05:11 box systemd[1]: Starting Elasticsearch...
Jul 20 14:05:12 box elasticsearch[85725]: Exception in thread "main" org.elasticsearch.bootstrap.BootstrapException: org.elasticsearch.cli.UserException: unable to create temporary keystore at [/etc/elasticsearch/elasticsearch.keystore.tmp], please check filesystem permissions
Jul 20 14:05:12 box elasticsearch[85725]: Likely root cause: java.nio.file.AccessDeniedException: /etc/elasticsearch/elasticsearch.keystore.tmp
Jul 20 14:05:12 box elasticsearch[85725]: at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84)
Jul 20 14:05:12 box elasticsearch[85725]: at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
Jul 20 14:05:12 box elasticsearch[85725]: at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
Jul 20 14:05:12 box elasticsearch[85725]: at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)
Jul 20 14:05:12 box systemd[1]: elasticsearch.service: main process exited, code=exited, status=1/FAILURE

"Custom" configuration and validation of elasticsearch.yml settings

This is related to #7 in the sense that I'm poking at some assumptions about how the formula should apply configuration and what it covers. I would like to open a discussion on these.

Right now the formula takes a number of directives for elasticsearch.yml, looks for these in the template and insets them into the rendered elasticsearch.yml.

Anything else (including node.master and node.data) are viewed as separate config, nested in elasticsearch.config.custom_options. These are passed along as is.

My question is if it makes sense to make this distinction - why not just pass along everything in elasticsearch.config directly to elasticsearch.yml?

Ensure paths exist

The directories specified via elasticsearch:config:path should be managed so that they exist with the correct permissions.

Support for Shield

I view shield as a core functionality of Elasticsearch and think it makes sense to have a discussion about how this formula could/should support the configuration.

Most other plugins can be configured via elatsicsearch.yml, but Shield requires more than what is available today, ranging from distribution of roles.yml to installation of the json license.

Should this functionality be separated into it's own state, e.g. elasticsearch.shield (x-pack from version 5 onward), or does it make sense to include it in the elasticsearch.config state?

apt-transport-https not supported in Flourine

Salt 2018.3.3
elasticsearch.major_version: 6

      ID: apt-transport-https
Function: pkg.installed
  Result: True
 Comment: All specified packages are already installed
 Started: 17:19:08.751183
Duration: 32.439 ms
 Changes:
Warnings: The following package(s) are "virtual package" names: apt-
          transport-https. These will no longer be supported as of the
          Fluorine release. Please update your SLS file(s) to use the actual
          package name.

Does not handle java opts with spaces

Fix to come when tested.

Setting

elasticsearch:
    sysconfig:
      ES_STARTUP_SLEEP_TIME: 30
     ES_JAVA_OPTS: -Xms2g -Xmx2g

ends up as ES_JAVA_OPTS=-Xms2g -Xmx2g which is not valid in shell/sysconfig and causes a service start error:

[ec2-user@ip-10-0-3-52 ~]$ sudo service elasticsearch start
/etc/sysconfig/elasticsearch: line 4: -Xmx2g: command not found

Support for pinning minor version, clean state tests

Is it just me or does state.highstate test=True always say the package will be upgraded even when it's up to date?

      ID: elasticsearch_pkg
Function: pkg.installed
    Name: elasticsearch
  Result: None
 Comment: The following packages would be installed/updated: elasticsearch=5.*
 Started: 23:23:50.533340
Duration: 1.268 ms
 Changes:

What do you think about adding support for pinning the minor version so test=True applies cleanly? I'd be happy to open a PR... also let me know if you have any other solutions in mind.

Does not work as expected on AWS Linux

Im currently investigating the cause, but running this formula on aws linux results in:

0:01:48     amazon-ebs: [ERROR   ] Command '/sbin/chkconfig --list elasticsearch' failed with return code: 1
20:01:48     amazon-ebs: [ERROR   ] stderr: service elasticsearch supports chkconfig, but is not referenced in any runlevel (run 'chkconfig --add elasticsearch')
20:01:48     amazon-ebs: [ERROR   ] retcode: 1
20:03:17     amazon-ebs: [ERROR   ] Command '/sbin/service elasticsearch start' failed with return code: 1
20:03:17     amazon-ebs: [ERROR   ] output: Starting elasticsearch: [FAILED]
20:03:17     amazon-ebs: [ERROR   ] Command '/sbin/chkconfig --list elasticsearch' failed with return code: 1
20:03:17     amazon-ebs: [ERROR   ] stderr: service elasticsearch supports chkconfig, but is not referenced in any runlevel (run 'chkconfig --add elasticsearch')
20:03:17     amazon-ebs: [ERROR   ] retcode: 1
20:03:17     amazon-ebs: [ERROR   ] {'elasticsearch': True}
20:03:49     amazon-ebs: local:

Running it twice results in a success.

Elasticsearch package isn't in the Ubuntu repo

Elasticsearch doesn't exist in Bionic so installation fails when determining version.

- Rendering SLS 'base:elasticsearch.plugins' failed: Jinja variable dict object has no element 0
  /var/tmp/.salt_1a862b_salt/running_data/var/cache/salt/minion/files/base/elasticsearch/settings.sls(20):
  ---
  [...]
    {% if pillar_major_version %}
      {% set major_version = pillar_major_version %}
    {% else %}
      {% set pkg_version = salt['pkg.version'](elasticsearch_map.pkg) %}
      {% if pkg_version %}
        {% set major_version = pkg_version[0] | int %}    <======================
      {% else %}
        {% set major_version = False %}
      {% endif %}
    {% endif %}
  {% endif %}

Controlling Elasticsearch cluster config state via Salt

So this has been something I've been thinking about for a while. I'm opening this issue to both note this down and maybe start a discussion if anyone else could be interested in a feature like this.

So what's this about?

Say I want to set cluster.routing.allocation.awareness when spinning up a new cluster. Maybe I want to inject a default template. Or set any other thing available via the Elasticsearch API in a managed way.

Great thing is that YAML defined in pillar translates easily to JSON and vice versa.

But is Saltstack able to do this in an easy way? I guess we're looking at something like salt.utils.http (info here: https://docs.saltstack.com/en/latest/topics/tutorials/http.html, https://www.youtube.com/watch?v=m9AQxcSDkaE)

Thoughts?

elasticsearch.plugins state apparently missing

I cannot see any elasticsearch.plugins state. It is possible that you forgot to add the sls to dee6a41 ?

That is causing the state not to compile:

sudo salt server state.sls elasticsearch
server:
    Data failed to compile:
----------
    Specified SLS elasticsearch.plugins in saltenv base is not available on the salt master or through a configured fileserver

Python 3 support

      ID: /etc/default/elasticsearch
Function: file.managed
  Result: False
 Comment: Unable to manage file: Jinja variable 'salt.utils.odict.OrderedDict object' has no attribute 'iteritems'
 Started: 17:42:45.215478
Duration: 93.955 ms
 Changes:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.