如何更改弹性搜索最大内存大小 [英] How to change Elasticsearch max memory size
问题描述
我有一个默认配置为Elasticsearch的Apache服务器,一切正常,除了默认配置的最大大小为1GB。
I have an Apache server with a default configuration of Elasticsearch and everything works perfectly, except that the default configuration has a max size of 1GB.
我不有如此大量的文件存储在Elasticsearch,所以我想减少记忆。
I don't have such a large number of documents to store in Elasticsearch, so I want to reduce the memory.
我看到我必须更改 -Xmx
参数在Java配置,但我不知道如何。
I have seen that I have to change the -Xmx
parameter in the Java configuration, but I don't know how.
我看到我可以执行这个:
I have seen I can execute this:
bin/ElasticSearch -Xmx=2G -Xms=2G
但是,当我必须重新启动Elasticsearch时,这将会丢失。
But when I have to restart Elasticsearch this will be lost.
有可能在安装Elasticsearch时更改最大内存使用量一个服务?
Is it possible to change max memory usage when Elasticsearch is installed as a service?
推荐答案
于2016年11月24日更新:Elasticsearch 5显然已经改变了配置JVM。 请参阅此处的答案。以下答案仍适用于版本<
Updated on Nov 24, 2016: Elasticsearch 5 apparently has changed the way to configure the JVM. See this answer here. The answer below still applies to versions < 5.
tirdadc,感谢您在下面的评论中指出这一点。
tirdadc, thank you for pointing this out in your comment below.
当我想知道内存和ES时,我有一个与他人分享的pastebin页面。这对我来说很有效: http://pastebin.com/mNUGQCLY 。我也会粘贴这里的内容:
I have a pastebin page that I share with others when wondering about memory and ES. It's worked OK for me: http://pastebin.com/mNUGQCLY. I'll paste the contents here as well:
参考文献:
https://github.com/grigorescu/Brownian/wiki/ElasticSearch-Configuration
http://www.elasticsearch.org/guide/reference/setup/installation/
编辑以下文件以修改内存和文件编号限制。这些说明假定Ubuntu 10.04可能适用于更高版本和其他发行版/操作系统。 (编辑:这适用于Ubuntu 14.04)。
Edit the following files to modify memory and file number limits. These instructions assume Ubuntu 10.04, may work on later versions and other distributions/OSes. (Edit: This works for Ubuntu 14.04 as well.)
/etc/security/limits.conf :
elasticsearch - nofile 65535
elasticsearch - memlock unlimited
/ etc / default / elasticsearch(在CentOS / RH:/ etc / sysconfig / elasticsearch):
ES_HEAP_SIZE=512m
MAX_OPEN_FILES=65535
MAX_LOCKED_MEMORY=unlimited
/etc/elasticsearch/elasticsearch.yml :
bootstrap.mlockall: true
这篇关于如何更改弹性搜索最大内存大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!