I am new to the Elasticsearch world. I had installed the Elasticsearch in one of my lab VM, where it is showing memory utilization is 8.3 GB when I check "systemctl status elasticsearch" and VM gets hang. Is there anyway we can reduce the memory utilization of elasticseach. Please advise.
As far as I know elasticsearch uses Java and the memory is controlled by Java heap size.
You can navigate to elasticsearch -> config -> vm.options and change your heap size.
For example: (you can set your own value)
-Xms1g
-Xmx1g
or
-Xms512m
-Xmx512m
And if you have too many shards (primary or replicas), it will impact your memory usage.
You can disable unnecessary plugins. They also consume memory.
Thanks @PodarcisMuralis . Now I can see the memory usage reduces according to the settings in jvm.options file. I tried to curl the IP of my host over 9200 (port is opened and used by elasticsearch process) but giving error as below. Could you please advise
[root@prestovm1 elasticsearch]# curl -X GET "xx.xx.xx.xx:9200"
curl: (52) Empty reply from server
By default, ES use 50% memory. As Podarcis said, set
-Xms2g
-Xmx2g
(without spaces at the begging of line)
in /etc/elasticsearch/jvm.options.d/jvm.options which template you have in /etc/elasticsearch/jvm.options, but do not add to root.
1-2 GB should be fine for learning purpose and not larger indices - few GB. For more info, read the blog .
@PodarcisMuralis Yes, curl command working properly and tested also but still the systemctl restart elasticsearch.service does not help me . I am getting same error while doing curl over port "9200".
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.