Elasticsearch Memory Utilization

Hi Team,

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.

Thanks,
Debasis

Hi,

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

Thanks,
Debasis

It seems that elasticsearch is not responding.

I assume you installed curl command and it is working correctly.
Did you restart elasticsearch?

systemctl restart elasticsearch

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 .

2 Likes

@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".

Thanks,
Debasis

@PodarcisMuralis Can you please help me on this.

Thanks,
Debasis

I am also out of options here.
If you use many nodes, please check if there is any firewall.
Please check if port 9200 works.

netstat -tulnp | grep 9200

Please check also elasticsearch logs.
var/log/elasticsearch

As a last option, reinstall elasticsearch.

1 Like

Thanks @PodarcisMuralis it works now. Actually I am starting elastic stack due to my interest not sure where to start. Could you please help me.

Thanks,
Debasis

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.