Elasticsearch 최대 메모리 크기를 변경하는 방법
기본 구성이 Elasticsearch 인 Apache 서버가 있으며 기본 구성의 최대 크기가 1GB 인 것을 제외하고는 모든 것이 완벽하게 작동합니다.
Elasticsearch에 저장할 문서가 너무 많지 않아서 메모리를 줄이고 싶습니다.
-Xmx
Java 구성에서 매개 변수 를 변경해야하는 것을 보았지만 방법을 모르겠습니다.
나는 이것을 실행할 수 있음을 보았다.
bin/ElasticSearch -Xmx=2G -Xms=2G
그러나 Elasticsearch를 다시 시작해야 할 때 이것은 손실됩니다.
Elasticsearch가 서비스로 설치된 경우 최대 메모리 사용량을 변경할 수 있습니까?
에서 ElasticSearch> = 5 문서가있다 변경 위의 답변 중 아무도 나를 위해 일한 의미한다.
나는 변화 시도 ES_HEAP_SIZE
에 /etc/default/elasticsearch
와에 etc/init.d/elasticsearch
,하지만 난 실행할 때 ps aux | grep elasticsearch
출력은 여전히 보여 주었다 :
/usr/bin/java -Xms2g -Xmx2g # aka 2G min and max ram
다음과 같이 변경해야했습니다.
/etc/elasticsearch/jvm.options
# Xms represents the initial size of total heap space
# Xmx represents the maximum size of total heap space
-Xms1g
-Xmx1g
# the settings shipped with ES 5 were: -Xms2g
# the settings shipped with ES 5 were: -Xmx2g
2016 년 11 월 24 일 업데이트 : Elasticsearch 5가 JVM 구성 방식을 변경 한 것 같습니다. 여기에서이 답변을 참조하십시오 . 아래 답변은 여전히 5 미만 버전에 적용됩니다.
tirdadc, 아래 의견에 이것을 지적 해 주셔서 감사합니다.
기억력과 ES에 대해 궁금 할 때 다른 사람들과 공유하는 pastebin 페이지가 있습니다. 나를 위해 잘 작동했습니다 : http://pastebin.com/mNUGQCLY . 여기에도 내용을 붙여 넣겠습니다.
참조 :
https://github.com/grigorescu/Brownian/wiki/ElasticSearch-Configuration http://www.elasticsearch.org/guide/reference/setup/installation/
메모리 및 파일 수 제한을 수정하려면 다음 파일을 편집하십시오. 이 지침은 Ubuntu 10.04를 가정하고 이후 버전 및 기타 배포 / OS에서 작동 할 수 있습니다. ( 편집 : Ubuntu 14.04에서도 작동합니다.)
/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
Centos 7 또는 SystemD를 실행하는 다른 시스템에서이 작업을 수행하려는 경우 다음에서 변경하십시오.
/etc/sysconfig/elasticsearch
ES_HEAP_SIZE 줄의 주석 처리를 제거하고 값을 설정합니다. 예 :
# Heap Size (defaults to 256m min, 1g max)
ES_HEAP_SIZE=16g
(1g max에 대한 설명은 무시하십시오. 이것이 기본값입니다)
지침 ubuntu 14.04
:
sudo vim /etc/init.d/elasticsearch
세트
ES_HEAP_SIZE=512m
다음에서 :
sudo vim /etc/elasticsearch/elasticsearch.yml
세트:
bootstrap.memory_lock: true
자세한 내용은 파일에 주석이 있습니다.
Previous answers were insufficient in my case, probably because I'm on Debian 8, while they were referred to some previous distribution.
On Debian 8 modify the service script normally place in /usr/lib/systemd/system/elasticsearch.service
, and add Environment=ES_HEAP_SIZE=8G
just below the other "Environment=*" lines.
Now reload the service script with systemctl daemon-reload
and restart the service. The job should be done!
If you use the service wrapper provided in Elasticsearch's Github repository, found at https://github.com/elasticsearch/elasticsearch-servicewrapper, then the conf file at elasticsearch-servicewrapper / service / elasticsearch.conf controls memory settings. At the top of elasticsearch.conf is a parameter:
set.default.ES_HEAP_SIZE=1024
Just reduce this parameter, say to "set.default.ES_HEAP_SIZE=512", to reduce Elasticsearch's allotted memory.
Note that if you use the elasticsearch-wrapper, the ES_HEAP_SIZE provided in elasticsearch.conf OVERRIDES ALL OTHER SETTINGS. This took me a bit to figure out, since from the documentation, it seemed that heap memory could be set from elasticsearch.yml.
If your service wrapper settings are set somewhere else, such as at /etc/default/elasticsearch as in James's example, then set the ES_HEAP_SIZE there.
If you installed ES using the RPM/DEB packages as provided (as you seem to have), you can adjust this by editing the init script (/etc/init.d/elasticsearch on RHEL/CentOS
). If you have a look in the file you'll see a block with the following:
export ES_HEAP_SIZE
export ES_HEAP_NEWSIZE
export ES_DIRECT_SIZE
export ES_JAVA_OPTS
export JAVA_HOME
To adjust the size, simply change the ES_HEAP_SIZE
line to the following:
export ES_HEAP_SIZE=xM/xG
(where x is the number of MB/GB of RAM that you would like to allocate)
Example:
export ES_HEAP_SIZE=1G
Would allocate 1GB.
Once you have edited the script, save and exit, then restart the service. You can check if it has been correctly set by running the following:
ps aux | grep elasticsearch
And checking for the -Xms and -Xmx flags in the java process that returns:
/usr/bin/java -Xms1G -Xmx1G
Hope this helps :)
In elasticsearch path home dir i.e. typically /usr/share/elasticsearch
, There is a config file bin/elasticsearch.in.sh
. Edit parameter ES_MIN_MEM
, ES_MAX_MEM
in this file to change -Xms2g
, -Xmx4g
respectively. And Please make sure you have restarted the node after this config change.
- Elasticsearch will assign the entire heap specified in jvm.options via the Xms (minimum heap size) and Xmx (maximum heap size) settings.
- -Xmx12g
- -Xmx12g
- Set the minimum heap size (Xms) and maximum heap size (Xmx) to be equal to each other.
Don’t set Xmx to above the cutoff that the JVM uses for compressed object pointers (compressed oops), the exact cutoff varies but is near 32 GB.
It is also possible to set the heap size via an environment variable
- ES_JAVA_OPTS="-Xms2g -Xmx2g" ./bin/elasticsearch
- ES_JAVA_OPTS="-Xms4000m -Xmx4000m" ./bin/elasticsearch
If you use windows server, you can change Environment Variable, restart server to apply new Environment Value and start Elastic Service. More detail in Install Elastic in Windows Server
In elasticsearch 2.x :
vi /etc/sysconfig/elasticsearch
Go to the block of code
# Heap size defaults to 256m min, 1g max
# Set ES_HEAP_SIZE to 50% of available RAM, but no more than 31g
#ES_HEAP_SIZE=2g
Uncomment last line like
ES_HEAP_SIZE=2g
참고URL : https://stackoverflow.com/questions/18132719/how-to-change-elasticsearch-max-memory-size
'program story' 카테고리의 다른 글
src / lxml / etree_defs.h : 9 : 31 : 치명적인 오류 : libxml / xmlversion.h : 해당 파일 또는 디렉터리가 없습니다. (0) | 2020.08.31 |
---|---|
execCommand에서 '일반 텍스트로 붙여 넣기'에 대한 Javascript 트릭 (0) | 2020.08.31 |
E : mongodb-org 패키지를 찾을 수 없습니다. (0) | 2020.08.31 |
RecyclerView에서 마지막 자식의 여백 / 패딩 (0) | 2020.08.31 |
모달에 매개 변수를 전달하는 방법은 무엇입니까? (0) | 2020.08.31 |