【问题标题】:Set cluster name of elasticsearch with environmental variable使用环境变量设置 elasticsearch 的集群名称
【发布时间】:2017-04-25 13:57:59
【问题描述】:

我正在使用 docker-compose 运行 elasticsearch 服务。我需要指定自定义集群名称。
正如我在github ticket 中发现的那样,我可以在 es.cluster.name 属性中传递自定义集群名称。这种方法对我有用。

问题:

是否可以使用环境变量设置集群名称,即使是 2.4 版和此 docker 映像 Docker hub?

在 docker documentation for 5.3 version 中,我看到我也可以在环境变量中指定它,但在 elasticsearch:2.4 中这是行不通的。由于 spring 数据兼容性,我必须使用 2.4 版本。

我没有设法在 2.4 版中完成此操作,还是仅在最新版本中启用?

docker compose 文件的一部分:

elastic:
    image: "elasticsearch:2.4-alpine"
    # Setting property value works
    command: "elasticsearch -Des.cluster.name=custom-cluster-name" 

    # Setting env properties is not working, but I would prefer it this way
    #environment: 
    # - es.cluster.name=custom-cluster-name

【问题讨论】:

  • 我也面临同样的问题。我认为问题在于环境变量中的点。如果变量名中有一个点,bash 会抛出一个错误

标签: elasticsearch docker-compose


【解决方案1】:

这对我有用(我使用的是 ES 1.5.2):

    command: elasticsearch -Des.cluster.name=<cluster_name>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-05-02
    • 2019-12-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多