Elasticsearch version (bin/elasticsearch --version
):
ElasticSearch 6.1.2
Plugins installed: [ searchguard]
JVM version (java -version
): Java(TM) SE Runtime Environment (build 1.8.0_112-b15)
OS version (uname -a
if on a Unix-like system): RHEL 6.8/7.2
Description of the problem including expected versus actual behavior:
After installing the RPM package of ElasticSearch, for multiple node configurations, modifying the system.d file's EnvironmentFile variable and init.d's ES_ENV_FILE variable to point to a different location than '/etc/sysconfig/elasticsearch' will continue to load the default /etc/sysconfig/elasticsearch if the file is present. Removing the file /etc/sysconfig/elasticsearch fixes the issue but it would appear somewhere in the init script of ES it checks to see if /etc/sysconfig/elasticsearch is present and loads that file regardless of what is actually set for the EnvironmentFile or ES_ENV_FILE
This was more prevalent on our RHEL 6.8 servers on init.d than it was on our RHEL 7.2 servers running system.d
I also encountered the same problem on elasticsearch version 6.2.4(CentOS 7) when I run multiple es nodes on the same server,after read the scripts under $ES_HOME/bin, the code in $ES_HOME/bin/elasticsearch-env may related to this issue. Details shown as follows:
On line 70 of elasticsearch-env: source /etc/sysconfig/elasticsearch,comment this line(or remove /etc/sysconfig/elasticsearch) and everything goes well except each time when installing plugins you need to specify ES_PATH_CONF manually first.
Hi, any news about this?
Any updates on this? In my case, it's a bit problematic as I'm using Elasticsearch v6.1.1 and I'm trying to run multiple instances of the process on the same server.
Hey @jasontedor . Is this issue planned to be fixed in upcoming releases soon? It is becoming a bit painful because only RPMs seems to have this inconsistent behavior :(
The workaround: you can edit the file elasticsearch-env and comment the line:
source /etc/sysconfig/elasticsearch
Is this issue planned to fixed in the coming releases?
I found the same problem when upgrading from 6.6.0 to 6.8.1 on an Ubuntu 16.04. On Ubuntu the standard configuration is read from /etc/default/elasticsearch instead of /etc/sysconfig/elasticsearch, but the issue is really the same.
As a solution I used the variable ES_PATH_CONF, set in systemd service file, as a flag for skipping the default sourcing. This is a patch:
--- /usr/share/elasticsearch/bin/elasticsearch-env.orig 2019-07-05 18:03:48.228665978 +0200
+++ /usr/share/elasticsearch/bin/elasticsearch-env 2019-07-05 18:00:15.804072022 +0200
@@ -68,7 +68,11 @@
export HOSTNAME=$HOSTNAME
-source /etc/default/elasticsearch
+# Give priority of any variable initialized by systemd unit and already in the environment
+if [ -z "$ES_PATH_CONF" ]
+then
+ source /etc/default/elasticsearch
+fi
if [ -z "$ES_PATH_CONF" ]; then
echo "ES_PATH_CONF must be set to the configuration path"
Bye,
Giuseppe
Please fix this finally, it's an easy fix in the /usr/share/elasticsearch/bin/elasticsearch-env
file.
I hit this problem today. Also.
Took me while to figure this out.
It is an easy fix and it would be nice if this can be fixed soon.
Most helpful comment
I found the same problem when upgrading from 6.6.0 to 6.8.1 on an Ubuntu 16.04. On Ubuntu the standard configuration is read from /etc/default/elasticsearch instead of /etc/sysconfig/elasticsearch, but the issue is really the same.
As a solution I used the variable ES_PATH_CONF, set in systemd service file, as a flag for skipping the default sourcing. This is a patch:
Bye,
Giuseppe