Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Cleanup installation and make shared file system prefixes optional #301

Closed
wants to merge 15 commits into from

Conversation

bndabbs
Copy link

@bndabbs bndabbs commented May 9, 2017

This is a lot of small changes and I wanted to submit them as separate pull requests for easier review, but a lot of them ended up being dependent on each other. I believe ee73f18 can be pulled out and moved to a separate PR if necessary, but I left it in there because I couldn't get my playbook to run without it.

The primary goal of this PR is to make the shared filesystem stuff optional, because I got tired of having to prefix the instance name to the service name when performing maintenance. I think the prefix is useful and necessary when operating in specific environments, but it adds unnecessary complexity for a lot of use cases.

@elasticmachine
Copy link
Collaborator

Jenkins standing by to test this. If you aren't a maintainer, you can ignore this comment. Someone with commit access, please review this and clear it for Jenkins to run.

1 similar comment
@elasticmachine
Copy link
Collaborator

Jenkins standing by to test this. If you aren't a maintainer, you can ignore this comment. Someone with commit access, please review this and clear it for Jenkins to run.

@Slach
Copy link

Slach commented Jul 25, 2017

es_use_shared_fs: false
it's a really usefull feature
pls someone, merge this PR

@greenhua
Copy link

good! +1

@gingerwizard
Copy link

Other than the plugin handling (which i think has subsequently improved) this makes considerable improvements to the current role. I'd like to get this merged but i think we first need to fix some critical issues this doesn't resolve. @barryib any thoughts on this? The ability to have only one instance per machine, and thus not be impacted by the instance_name seems like a popular request.

@AutomationD
Copy link

AutomationD commented Sep 28, 2017

Any chance to take care of this? Thanks!

@bndabbs Also, I'm wondering if we could ensure that since we don't have a concept of instance any more, should we not append es_instance_name to everything? I did it here #351

Let me know what you think!

@bndabbs
Copy link
Author

bndabbs commented Oct 7, 2017

This PR had gotten pretty far behind the current master, so I did a rebase this evening to bring everything up-to-date.

@AutomationD
Copy link

@elasticmachine test (?)
@gingerwizard any additional changes before this can be merged?

Thank you

@AutomationD
Copy link

AutomationD commented Oct 16, 2017

@bndabbs actually, I just realized that es_instance_name is still appended to everything. Is there a reason why we still keep it in the single-node mode? if it is not specified ES breaks:
Starting Elasticsearch-...

Also, default es_use_shared_fs: falsewill probably break backwards-compatibility.

@AutomationD
Copy link

I submitted changes back to your fork @bndabbs bndabbs#1

@ajrpayne
Copy link

I submitted changes that I believe clean up the params section a bit. @bndabbs

@karmi
Copy link

karmi commented Nov 14, 2017

Hi @bndabbs, we have found your signature in our records, but it seems like you have signed with a different e-mail than the one used in yout Git commit. Can you please add both of these e-mails into your Github profile (they can be hidden), so we can match your e-mails to your Github profile?

@bndabbs
Copy link
Author

bndabbs commented Nov 14, 2017

@karmi I believe the emails are sorted out now.

@@ -1,6 +1,6 @@
---

- set_fact: es_script_dir={{ es_conf_dir }}/{{es_instance_name}}
- set_fact: es_script_dir={{ es_conf_dir }}{{ es_conf_dir }}{{'/' + es_instance_name if es_use_shared_fs else ''}}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The double es_conf_dir looks like a bug?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does to me. I made a pull request with @bndabbs to remove it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been merged now.

@karmi
Copy link

karmi commented Nov 15, 2017

@bndabbs, yes, thanks, the check is now green!

@ajrpayne
Copy link

I think es_use_shared_fs: true should be the default to maintain backwards-compatibility.

@bndabbs
Copy link
Author

bndabbs commented Nov 15, 2017

@ajrpayne good call. I flipped the default on that.

@janhoy
Copy link

janhoy commented Nov 18, 2017

I’ve tested your PR with my install and it looks good. Is there perhaps need for README changes as well, before merging?

@janhoy
Copy link

janhoy commented Nov 27, 2017

@bndabbs, @karmi What's left on this now?

@janhoy
Copy link

janhoy commented Nov 27, 2017

@bndabbs We think we might have found a bug with this PR. If you have plugins defined, upgrading to a newer ES version using this role gives this error:

/usr/share/elasticsearch/bin/elasticsearch -Epath.conf=/etc/elasticsearch
[2017-11-27T14:52:22,712][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [control] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalArgumentException: plugin [analysis-phonetic] is incompatible with version [5.6.4]; was designed for version [5.6.3]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:136)
    ...

I believe the problem is that the variable es_install.changed is used to determine whether to reinstall plugins but the var is never defined anywhere...?

@janhoy
Copy link

janhoy commented Nov 28, 2017

Well, I now understand that es_install.changed gets automatically set if the install task causes a change in state. But it does not seem to work, the var es_plugins_reinstall gets set to False in line 6 of elasticsearch-plugins.yml:

set_fact: es_plugins_reinstall={{ es_install.changed }}

I can workaround the bug by setting that line to True. It does not help to set the es_plugins_reinstall variable to True in my inventory.

@janhoy
Copy link

janhoy commented Dec 4, 2017

Hello @bndabbs ? :)

@bndabbs
Copy link
Author

bndabbs commented Dec 4, 2017

@janhoy I'll take a look at the plugin logic and see if I can figure that out.

@janhoy
Copy link

janhoy commented Dec 17, 2017

@bndabbs figured it out yet? I'd really like for this PR to be merged soon as we base our install on it.

@janhoy
Copy link

janhoy commented Jan 3, 2018

Hi, any luck with this? I'm considering reverting back to latest release since this PR seems to be going nowhere anytime soon?

@ajrpayne
Copy link

@janhoy
What OS are you using? Was 5.6.4 installed by some other method that would cause es_install to return false?

@janhoy
Copy link

janhoy commented Jan 22, 2018

I've rolled back to default version of the role since this PR is going nowhere. I was using CentOS, and installed with this role+PR from a clean system. It is easily reproducible by doing an install with plugins, then do an upgrade to a newer minor version.

Bradford Dabbs and others added 7 commits February 2, 2018 13:56
Cleaned up the facts.

conf_dir is set in defaults and reset in elasticsearch-sharedfs.yml if es_use_shared_fs is true.
instance_default_file was being reset at the bottom of the params file.
instance_init_script was being reset at the bottom of the params file as well.
Copy link
Contributor

@Crazybus Crazybus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is some really great work! Left a couple of small comments (one which is causing a test to fail). Really love what you have done to simplify a lot of the role!

@@ -8,7 +8,7 @@ cluster.name: elasticsearch
{% endif %}

{% if es_config['node.name'] is not defined %}
node.name: {{inventory_hostname}}-{{es_instance_name}}
node.name: {{inventory_hostname}}{{' - ' + es_instance_name if es_use_shared_fs else ''}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the extra spaces around - intentional? This is causing the tests to fail because the node changed localhost-node1 to localhost - node1

@@ -67,7 +67,7 @@ if [ ! -z "$CONF_FILE" ]; then
fi

exec="$ES_HOME/bin/elasticsearch"
prog="{{es_instance_name}}_{{default_file | basename}}"
prog="{{es_instance_name + '_' if es_use_shared_fs else ''}}{{default_file | basename}}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to move all of '_' if es_use_shared_fs else '' logic into defaults/main.yml? It makes it a lot more readable and means that any future changes won't need to keep copy pasting this if else statement everywhere.

@ajrpayne
Copy link

I like the changes @bndabbs. Made a pull request that I thought brought it more in line with the sharedfs structure you were going for.

@Crazybus
Copy link
Contributor

Sorry for the late reply just got back from holidays! 🌞

Almost there! Looks like only a couple small fixes are needed before this can be merged!

image

The Ubuntu 14.04 tests seems to be failing because of the service detection stuff. You can run this locally with kitchen converge standard-ubuntu-1404 and kitchen verify standard-ubuntu-1404 to run the tests.

17:36:32        TASK [elasticsearch : Include tasks specific to installed service manager] *****
17:36:32        fatal: [localhost]: FAILED! => {"reason": "Unable to retrieve file contents\nCould not find or access '/tmp/kitchen/elasticsearch-sshd.yml'"}

Apart from that only the multi suites are failing with elasticsearch failing to start up. You can easily run this locally with kitchen converge multi-ubuntu-1604 and kitchen verify multi-ubuntu-1604 to run the tests. The variables for this suite can be found in https://github.com/elastic/ansible-elasticsearch/blob/master/test/integration/multi.yml

18:04:18        TASK [elasticsearch : Wait for elasticsearch to startup] ***********************
18:09:18        fatal: [localhost]: FAILED! => {"changed": false, "elapsed": 300, "msg": "Timeout when waiting for localhost:9201"}

@AutomationD
Copy link

@bndabbs Any chance to make a last push to get it merged? Thanks!

@rozling
Copy link

rozling commented Aug 2, 2018

Would love to see this merged. Is there anything I / others can do to help?

@botelastic
Copy link

botelastic bot commented Sep 18, 2019

This PR has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
To track this PR (even if closed), please open a corresponding issue if one does not already exist.

@botelastic
Copy link

botelastic bot commented Oct 18, 2019

This PR has been automatically closed because it has not had recent activity since being marked as stale.
Please reopen when work resumes.

@botelastic botelastic bot closed this Oct 18, 2019
@Slach
Copy link

Slach commented Oct 18, 2019

so sad ;-(( this PR was really usefull i hope currently ansible-elasticsearch role implements some analogs

@jmlrt
Copy link
Member

jmlrt commented Oct 18, 2019

Hi @Slach,
What exact part of this PR did you need?
Don't hesitate to create a new PR based on current master branch if you think there is still a need for it.

@Slach
Copy link

Slach commented Oct 18, 2019

i use this PR for install once elasticsearch instance to once host directly to /var/lib/elasticsearch/data instead of /var/lib/something-with-instance-name/

@jmlrt
Copy link
Member

jmlrt commented Oct 18, 2019

Are you still using this 2 years old branch PR for your Elasticsearch deployments?
I think what you need has already been implemented in #566. You can refer to multi-instance.md and #554 (comment) for more details.

I also encourage you to use 7.4.0 release Ansible Galaxy or master branch of the role now that we are trying to release our roles more often (please check the [CHANGELOG.md] (https://github.com/elastic/ansible-elasticsearch/blob/master/CHANGELOG.md) and test it on a dev environment before as they will be breaking changes).

@Slach
Copy link

Slach commented Oct 18, 2019

@jmlrt oh, thanks a lot for explanation ;-)
no, currently i use clickhouse with ngram indexes and Grafana Loke instead of Elasticsearch
so i happy for this ticket close

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.