We are using packages to distribute our config files in custom directory for the ES service. We can't replace /etc/sysconfig/elasticsearch, because it is owned by the elasticsearch package.
I've noticed similar issues reported, but nothing was done. The main reason this happens is because in /usr/share/elasticsearch/bin/elasticsearch-env we always source /etc/sysconfig/elasticsearch. This leads that ES_PATH_CONF always points to /etc/elasticsearch.
If you installed using the .rpm package you will need to edit the file /etc/sysconfig/elasticsearch to change the value of ES_PATH_CONF, this is documented here.
For the package distributions, the config directory location defaults to /etc/elasticsearch . The location of the config directory can also be changed via the ES_PATH_CONF environment variable, but note that setting this in your shell is not sufficient. Instead, this variable is sourced from /etc/default/elasticsearch (for the Debian package) and /etc/sysconfig/elasticsearch (for the RPM package). You will need to edit the ES_PATH_CONF=/etc/elasticsearch entry in one of these files accordingly to change the config directory location.
This comes from the service file that has this line:
EnvironmentFile=-/etc/sysconfig/elasticsearch
So, to change the value of ES_PATH_CONF while using the package distribution you will need to edit the elasticsearch file inside /etc/sysconfig or edit the /usr/lib/systemd/system/elasticsearch.service systemd service file.
You can also create a different systemd service file and use it to start your elasticsearch service.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.