在Elasticsearch 7的文档中,它明确表示
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.
有没有办法为软件包分发安装的其他
/etc/default/elasticsearch
文件指定我自己的路径?我已经尝试通过在我的systemd服务文件中添加以下内容来尝试该文件,该文件使用我想要的EnvironmentFile,但是在服务启动时仍使用/etc/default/elasticsearch
。[Service]
...
EnvironmentFile=-/etc/default/elasticsearch-development
最佳答案
对此的答案(至少对于7.7.0版而言)是,由于没有提供任何选项或环境变量,因此无法无缝地执行此操作。但是,可以编辑软件包安装随附的/usr/share/elasticsearch/elasticsearch-env
文件,并用以下内容替换第81行:
if [ ! -z "$ES_DEFAULT" ]; then
source $ES_DEFAULT
else
source /etc/default/elasticsearch
fi
然后可以在系统服务文件中将
ES_DEFAULT
设置为指向其他/etc/default
文件。[Service]
...
Environment=ES_DEFAULT=/etc/default/elasticsearch-development
关于elasticsearch - 有没有办法更改elasticsearch 7的/etc/default/elasticsearch文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62307901/