Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue supplying datadir as a string, not as array. #802

Closed
wonkyto opened this issue Apr 10, 2017 · 6 comments
Closed

Issue supplying datadir as a string, not as array. #802

wonkyto opened this issue Apr 10, 2017 · 6 comments
Labels
Milestone

Comments

@wonkyto
Copy link

wonkyto commented Apr 10, 2017

  • Module version: 'elastic-elasticsearch', '5.1.0'
  • Puppet version: puppet-3.8.6-2.el6sat.noarch
  • OS and version: Red Hat Enterprise Linux Server release 6.7 (Santiago)

Bug description

This isn't necessarily a bug with the Elastic Puppet model, however there is an impact of using this module to configure data-nodes when supplying datadir settings.

Since upgrading to version 5.3.0 we've experienced an issue when configuring our elasticsearch.yml using the following format

path.data:
  - /data/elasticsearch/disk01/data-node-02
  - /data/elasticsearch/disk02/data-node-02
  - /data/elasticsearch/disk03/data-node-02
  - /data/elasticsearch/disk04/data-node-02

Unfortunately there appears to be a bug which also adds an unspecified 5th location of /var/lib/elasticsearch to the path.data array.

[2017-04-10T13:09:22,752][INFO ][o.e.e.NodeEnvironment    ] [HOSTNAME-data-node-02] using [5] data paths, mounts [[/data/elasticsearch/disk04 (/dev/vde1), /data/elasticsearch/disk03 (/dev/vdd1), /data/elasticsearch/disk02 (/dev/vdc1), /var (/dev/mapper/vg_volgrp01-lv_var), /data/elasticsearch/disk01 (/dev/vdb1)]], net usable_space [1tb], net total_space [1.1tb], spins? [possibly], types [ext4]

Apparently this relates to https://github.com/elastic/elasticsearch/pull/8381 however we've only experienced this issue since upgrading to Elasticsearch 5.3.0. The only work around from Elastic support was to write the path.data variable as a string (not array). We were encouraged to NOT use the array format going forward.

path.data: "/data/elasticsearch/disk01/data-node-02, /data/elasticsearch/disk02/data-node-02, /data/elasticsearch/disk03/data-node-02, /data/elasticsearch/disk04/data-node-02"

Now while manually changing the format of the elasticsearch.yml does resolve the issue, the problem with using the Elastic Puppet module is that previously we supplied each datadir as an array

 elasticsearch::instance { $name:
    datadir => ['/data/elasticsearch/disk01/data-node-02', '/data/elasticsearch/disk02/data-node-02', '/data/elasticsearch/disk03/data-node-02', '/data/elasticsearch/disk04/data-node-02']
  }

Now we must supply as a string

 elasticsearch::instance { $name:
    datadir => '/data/elasticsearch/disk01/data-node-02, /data/elasticsearch/disk02/data-node-02, /data/elasticsearch/disk03/data-node-02, /data/elasticsearch/disk04/data-node-02'
  }

But this has the unfortunately side effect that the Elastic Puppet module tries to create the directory location: '/data/elasticsearch/disk01/data-node-02, /data/elasticsearch/disk02/data-node-02, /data/elasticsearch/disk03/data-node-02, /data/elasticsearch/disk04/data-node-02', and fails because this isn't a valid directory.

Error: /Stage[main]/Profile::Elasticsearch::Data_node/Profile::Elasticsearch::Data_node::Instance[data-node-02]/Elasticsearch::Instance[data-node-02]/File[/data/elasticsearch/disk01/data-node-02, /data/elasticsearch/disk02/data-node-02, /data/elasticsearch/disk03/data-node-02, /data/elasticsearch/disk04/data-node-02]/ensure: change from absent to directory failed: Cannot create /data/elasticsearch/disk01/data-node-02, /data/elasticsearch/disk02/data-node-02, /data/elasticsearch/disk03/data-node-02, /data/elasticsearch/disk04/data-node-02; parent directory /data/elasticsearch/disk01/data-node-02, /data/elasticsearch/disk02/data-node-02, /data/elasticsearch/disk03/data-node-02, /data/elasticsearch/disk04 does not exist

We are stuck between a rock and hard place. We can't use the elastic puppet module to configure the nodes because of a bug within Elasticsearch, however the advice from Elastic is to not use the format that the Puppet module uses.

@tylerjl tylerjl added the triage label Apr 10, 2017
@tylerjl
Copy link
Contributor

tylerjl commented Apr 10, 2017

Wow, yep, that's pretty serious upstream bug. You're right that in its current state, the module isn't going to be able to support that workaround because of the mkdir exec in the instance.pp file. I'm not super familiar with the behavior of the bug, but does the problem persist if the datadir is specified as an array as normal but the DATA_DIR directory that points to the default directory is set to empty? (with something like init_defaults => { 'DATA_DIR' => '' }

@tylerjl
Copy link
Contributor

tylerjl commented Apr 11, 2017

@wonkyto (and any other observers), I have a changed staged in my fork that places the instance's config hash at the highest precedence level when merging the final instance configuration. This means that instead of defining datadir => 'foo,bar', you should be able to set config => { 'path.data' => 'foo,bar' } on an elasticsearch::instance and it'll be written in the final config. The datadir parameter mostly serves to handle directory creation for the paths you define - if they already exist, you should be able to set the path.data value manually and override it with a value that doesn't get mkdir-ed and causes the error you're seeing.

If someone can confirm this serves as a viable workaround, I can merge and release it.

@wonkyto
Copy link
Author

wonkyto commented Apr 11, 2017

Hi @tylerjl

Thanks for getting following up and sorry for the delay, I was not available yesterday.

I have tested your fork and I confirm that this works.

Thanks very much for such a quick turn around.

@wonkyto
Copy link
Author

wonkyto commented Apr 11, 2017 via email

@geekpete
Copy link

Related: elastic/elasticsearch#23981

@tylerjl tylerjl mentioned this issue Apr 12, 2017
5 tasks
@tylerjl tylerjl added this to the Next Release milestone Apr 13, 2017
@tylerjl
Copy link
Contributor

tylerjl commented Apr 13, 2017

@tylerjl tylerjl closed this as completed Apr 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants