-
Notifications
You must be signed in to change notification settings - Fork 25.3k
Some elasticsearch-cli tools could not be run not from ES_HOME #39937
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
Conversation
Pinging @elastic/es-core-infra |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good change. Let's remove the cd
from bin/elasticsearch(.bat)?
.
@jasontedor sorry, I don't understand why do you propose to remove cd ES_HOME from bin/elasticsearch. bin/elasticsearch is not based on bin/elasticsearch-cli, so cd is still needed there |
run elasticsearch-ci/bwc |
Sorry for causing the confusion. What I mean explicitly is, let us relocate this global to |
Why do we need to cd at all? Shouldn't ensuring relative paths work be done in Environment, eg by making the path to path.data relative to ES_HOME if it is not absolute? I don't think we should rely on the working directory at all. |
We need the working directory to be correct for ES for example to set the GC logs path relative to home. It’s not possible otherwise. |
Thanks, @jasontedor, I've made requested changes, can you please take a look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
This commit adds cd $ES_HOME to elasticsearch-env and removes it from elasticsearch. This way, both elasticsearch and elasticsearch-cli are executed with the working directory set to $ES_HOME. The need for the fix arose from the following bug: 1. Explicitly set path.data to relative to ES_HOME path in elasticsearch.yml. 2. Run elasticsearch from any directory. Elasticsearch is able to correctly start. 3. Stop elasticsearch. 4. Run elasticsearch-node unsafe-bootstrap, not from ES_HOME directory. It will fail with an exception. This commit fixes the issue and adds a new test. This PR fixes the issue and adds a new test. Also tests >=100 are renamed because alphabetic order does not work for them. (cherry picked from commit 2ffc293)
This commit adds cd $ES_HOME to elasticsearch-env and removes it from elasticsearch. This way, both elasticsearch and elasticsearch-cli are executed with the working directory set to $ES_HOME. The need for the fix arose from the following bug: 1. Explicitly set path.data to relative to ES_HOME path in elasticsearch.yml. 2. Run elasticsearch from any directory. Elasticsearch is able to correctly start. 3. Stop elasticsearch. 4. Run elasticsearch-node unsafe-bootstrap, not from ES_HOME directory. It will fail with an exception. This commit fixes the issue and adds a new test. This PR fixes the issue and adds a new test. Also tests >=100 are renamed because alphabetic order does not work for them. (cherry picked from commit 2ffc293)
@andrershov I think that you missed backporting this to 7.x. Also note whether or not #40083 is applicable, and you'll need #40118 too. I've added the |
This commit adds cd $ES_HOME to elasticsearch-env and removes it from elasticsearch. This way, both elasticsearch and elasticsearch-cli are executed with the working directory set to $ES_HOME. The need for the fix arose from the following bug: 1. Explicitly set path.data to relative to ES_HOME path in elasticsearch.yml. 2. Run elasticsearch from any directory. Elasticsearch is able to correctly start. 3. Stop elasticsearch. 4. Run elasticsearch-node unsafe-bootstrap, not from ES_HOME directory. It will fail with an exception. This commit fixes the issue and adds a new test. This PR fixes the issue and adds a new test. Also tests >=100 are renamed because alphabetic order does not work for them. (cherry picked from commit 2ffc293 with fixes by #40083 and #40118)
@jasontedor thank you for noticing this, I've mistakenly pushed 7.x to my fork instead of this repo. Fixed. |
The issue was found when working on
elasticsearch-node
tool.elasticsearch
from any directory. Elasticsearch is able to correctly start.elasticsearch-node unsafe-bootstrap
not from ES_HOME directory. It will fail with the following exceptionThis issue happens because
elasticsearch-node
useselasticsearch-cli
script that does not cd to ES_HOME before running the tool.elasticsearch
launch script on the hand cd's to ES_HOME before running es java process.This PR fixes the issue and adds a new test.
Also tests >=100 are renamed because alphabetic order does not work for them.