Configure limit.conf for ElasticSearch server

The Elasticsearch documentation says that I should configure nofile and nproc for better performance.
But the documentation is a bit confusing.

First, do I set it to the "elastic" user that was created by Elasticsearch upon installation or to the "elasticsearch" user (which was not created at all)?

Second, how will the file /etc/security/limits.conf actually look after configuration? Will it look like the code below?

elasticsearch    -       nofile       65535
elasticsearch    -       nproc        4096

Source:

How did you install elasticsearch? If you installed using a package manager like deb or rpm than the user elasticsearch will be created during installation.

You need to edit the limits for the user that will run Elasticsearch, which is normally elasticsearch.

Also, if you installed using deb or rpm you basically do not need to worry about nofile and nproc as the systemd process will set it automatically.

But if you need to manually configure the file this is correct:

1 Like

Thanks @leandrojmp ,
I installed using Debian Package.

However, should I still worry about changing the sysctl -w vm.max_map_count=262144 and LimitMEMLOCK=infinity?

You need to add the LimitMEMLOCK to a systemd override file, but does not need to configure the vm.max_map_count when using systemd.

You need to follow the documentation about Important System Configuration and do what it is need to your case.

When using packages like DEB or RPM, there is not much to change.

1 Like

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