【问题标题】:Is there a way to change the /etc/default/elasticsearch file for elasticsearch 7?有没有办法更改 elasticsearch 7 的 /etc/default/elasticsearch 文件?
【发布时间】:2020-06-10 15:58:31
【问题描述】:

在 elasticsearch 7 的文档中明确说明

对于包分发,配置目录位置默认为 到 /etc/elasticsearch 。 config目录的位置也可以 通过 ES_PATH_CONF 环境变量进行更改,但请注意 在你的 shell 中设置它是不够的。相反,这个变量 来自 /etc/default/elasticsearch (用于 Debian 软件包) 和 /etc/sysconfig/elasticsearch(用于 RPM 包)。你会需要 在其中之一中编辑 ES_PATH_CONF=/etc/elasticsearch 条目 文件以更改配置目录位置。

有没有办法为包分发安装的不同/etc/default/elasticsearch 文件指定我自己的路径?我已经尝试在我的 systemd 服务文件中添加以下内容,该文件使用我想要的 EnvironmentFile,但是当服务启动时它仍然使用/etc/default/elasticsearch

[Service]
...
EnvironmentFile=-/etc/default/elasticsearch-development

【问题讨论】:

    标签: elasticsearch


    【解决方案1】:

    这个问题的答案(至少对于 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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-06-12
      • 1970-01-01
      • 2022-06-23
      • 2023-02-18
      • 2013-07-03
      相关资源
      最近更新 更多