Max file descriptors [4096] for elasticsearch process is too low - Running as a service

Hello All,

Instead of run elasticsearch as a command everytime I start the machine, I decided to switch as a service. An old issue related to the max file descriptors came back but this time I could not make work when trying to run the service.

Here's the service:

[Unit]
Description=Elasticsearch core component
After=network.target

[Service]
User=elastic
ExecStart=/opt/elasticsearch/bin/elasticsearch
Restart=always

[Install]
WantedBy=multi-user.target

Here's the limits.conf

root soft nofile 65536
root hard nofile 65536
elastic soft nofile 65536
elastic hard nofile 65536

And here is the log:

[2019-11-17T18:28:44,196][DEBUG][o.e.a.ActionModule ] [linux] Using REST wrapper from plugin org.elasticsearch.xpack.security.Security
[2019-11-17T18:28:48,748][INFO ][o.e.d.DiscoveryModule ] [linux] using discovery type [zen] and seed hosts providers [settings]
[2019-11-17T18:28:52,877][INFO ][o.e.n.Node ] [linux] initialized
[2019-11-17T18:28:52,891][INFO ][o.e.n.Node ] [linux] starting ...
[2019-11-17T18:28:53,533][INFO ][o.e.t.TransportService ] [linux] publish_address {192.168.1.113:9300}, bound_addresses {192.168.1.113:9300}
[2019-11-17T18:28:53,614][INFO ][o.e.b.BootstrapChecks ] [linux] bound or publishing to a non-loopback address, enforcing bootstrap checks
[2019-11-17T18:28:53,633][ERROR][o.e.b.Bootstrap ] [linux] node validation exception
[1] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
[2019-11-17T18:28:53,674][INFO ][o.e.n.Node ] [linux] stopping ...
[2019-11-17T18:28:53,795][INFO ][o.e.n.Node ] [linux] stopped
[2019-11-17T18:28:53,796][INFO ][o.e.n.Node ] [linux] closing ...
[2019-11-17T18:28:53,902][INFO ][o.e.n.Node ] [linux] closed

Appreciate any help on what might be missing here.

Hi, with systemd the config is now in a different location. Here's the configuration we use:

# cat /etc/systemd/system/elasticsearch.service.d/override.conf 
[Service]
LimitMEMLOCK=infinity
LimitNOFILE=65536

After creating this file you'll need to reload the systemd configuration:

systemctl daemon-reload

Thanks for the tip! I added to my own elastic.service that I created and the issue was solved.