2016-11-09 89 views
3

我们Elasticsearch集群下去,当我试图与重新启动它:设置Java环境变量的Elasticsearch服务

docker start -i elasticsearch 

我得到的错误:

Error: encountered environment variables that are no longer supported 
Use jvm.options or ES_JAVA_OPTS to configure the JVM 
ES_HEAP_SIZE=6g: set -Xms6g and -Xmx6g in jvm.options or add "-Xms6g -Xmx6g" to ES_JAVA_OPTS 

我不太肯定为此设置选项。我修改了我们的elasticsearch.service文件,包括它的开始:

ExecStart=/usr/bin/docker run --name elasticsearch -p ####:#### -p ####:#### -e ES_HEAP_SIZE=6g -e ES_JAVA_OPTS="-Xms6g -Xmx6g" -v /srv/esconfig:/usr/share/elasticsearch/confg 

但错误依然存在。

+1

什么是基础映像,并在使用弹性搜索的版本?当你说,环境下降了,它必须提前运行。头部尺寸设定较早?或者你现在是第一次设置? – Rao

+0

我相信他们是最新的Elasticsearch 5.0.0。之前设置的唯一选项是ES_HEAP_SIZE。直到最近才发现环境变量错误。 – Catalog

回答

1

您不应该在运行语句中使用ES_HEAP_SIZE,它将被替换为ES_JAVA_OPTS。

但是,-e ES_JAVA_OPTS =“ - Xms6g -Xmx6g”仅当-Xms2g和-Xmx2g选项在/etc/elasticsearch/jvm.options文件中注释掉时才起作用。或者,您可以跳过ES_HEAP_SIZE和ES_JAVA_OPTS env变量,并使用jvm.options文件配置堆设置。

详细说明可以在这里找到: https://www.elastic.co/guide/en/elasticsearch/reference/5.1/heap-size.html

例子:

docker run --name=elasticsearch -p 9200:9200 -p 9300:9300 -v /data/elk-conf/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v /data/elk-conf/jvm.options:/etc/elasticsearch/jvm.options -d elasticsearch:5.1.1