You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 18, 2020. It is now read-only.
Embedded ES will not grab the wrong configuration like ports, data dirs or other stuff put into Settings when the environment variables ES_HOME and/or ES_PATH_CONF are set.
I discovered this on Windows were I recently installed a new ES6.5.4 via the new .msi-Installer.
Because I had an older (unzipped) "installation" before which indizes I wanted to upgrade, I supplied custom config and data dirs in the Installer.
Seems this installed global System/User wide environment variables ES_HOME and ES_PATH_CONF
pointing to the configured directories. I'm pretty sure that I did not set those environment vars myself.
The usual startup scripts on windows (and on a superficial inspection on *nix, too) use these environment vars to bootstrap all other config stuff.
Not sure if Linux package installation does the same thing, but other installers might?!
So when starting up the unzipped elastic instance and running the start script, (all) settings supplied by the builder will be useless, as the startup script even changes directory to the other installed instance pointed to by ES_HOME and also grabs all config from the config-dir in ES_PATH_CONF.
This might even corrupt existing indizes when running integration tests if the user is not aware of this behaviour and did not specify other names for test indizes.
As a fix I'd suggest to remove those preset (global/user wide) environment variables from the the forked process's environment, starting around here:
if (builder.environment().containsKey("ES_HOME")) {
builder.environment().remove("ES_HOME");
}
if (builder.environment().containsKey("ES_PATH_CONF")) {
builder.environment().remove("ES_PATH_CONF");
}
or put the "correct" pathes in there (like the just created/configured install and config directories).
Removing seems (as of now) not to be problematic for the zipped distributions, as those starter scripts do a fair amount of guessing the bootstrap directories themselves if they are not supplied.
At least you might want to insert a warning/comment about those environment variables into the README.md?
[EDITED: removed "not" in the 1st sentence]
The text was updated successfully, but these errors were encountered:
AFurtner
changed the title
env variables ES_HOME and ES_PATH_CONF might lead to incorrect config being used and potentially even corrupt other
env variables ES_HOME and ES_PATH_CONF lead to incorrect config being used and might even corrupt existing indizes
Feb 8, 2019
AFurtner
pushed a commit
to AFurtner/embedded-elasticsearch
that referenced
this issue
Feb 8, 2019
Embedded ES will
notgrab the wrong configuration like ports, data dirs or other stuff put into Settings when the environment variables ES_HOME and/or ES_PATH_CONF are set.I discovered this on Windows were I recently installed a new ES6.5.4 via the new .msi-Installer.
Because I had an older (unzipped) "installation" before which indizes I wanted to upgrade, I supplied custom config and data dirs in the Installer.
Seems this installed global System/User wide environment variables ES_HOME and ES_PATH_CONF
pointing to the configured directories. I'm pretty sure that I did not set those environment vars myself.
The usual startup scripts on windows (and on a superficial inspection on *nix, too) use these environment vars to bootstrap all other config stuff.
Not sure if Linux package installation does the same thing, but other installers might?!
So when starting up the unzipped elastic instance and running the start script, (all) settings supplied by the builder will be useless, as the startup script even changes directory to the other installed instance pointed to by ES_HOME and also grabs all config from the config-dir in ES_PATH_CONF.
This might even corrupt existing indizes when running integration tests if the user is not aware of this behaviour and did not specify other names for test indizes.
As a fix I'd suggest to remove those preset (global/user wide) environment variables from the the forked process's environment, starting around here:
embedded-elasticsearch/core/src/main/java/pl/allegro/tech/embeddedelasticsearch/ElasticServer.java
Line 79 in 8e443c4
and add something like:
or put the "correct" pathes in there (like the just created/configured install and config directories).
Removing seems (as of now) not to be problematic for the zipped distributions, as those starter scripts do a fair amount of guessing the bootstrap directories themselves if they are not supplied.
At least you might want to insert a warning/comment about those environment variables into the README.md?
[EDITED: removed "not" in the 1st sentence]
The text was updated successfully, but these errors were encountered: