为Elasticsearch服务设置Java环境variables

我们的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 

但是错误依然存在。

您的运行语句中不应再使用ES_HEAP_SIZE,它会被replace为ES_JAVA_OPTS。

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

详细说明可以在这里find: 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 
Interesting Posts