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

**URL:** <https://discuss.elastic.co/t/max-file-descriptors-4096-for-elasticsearch-process-is-too-low-running-as-a-service/208238>\
**Category:** Elasticsearch\
**Created:** [November 17, 2019, 11:36pm UTC](https://discuss.elastic.co/t/max-file-descriptors-4096-for-elasticsearch-process-is-too-low-running-as-a-service/208238 "2019-11-17T23:36:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mauriciothomsen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mauriciothomsen/32/36507_2.png) [@mauriciothomsen](https://discuss.elastic.co/u/mauriciothomsen)\
**Post date:** [November 17, 2019, 11:36pm UTC](https://discuss.elastic.co/t/max-file-descriptors-4096-for-elasticsearch-process-is-too-low-running-as-a-service/208238/1 "2019-11-17T23:36:17Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ariemenschneider](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ariemenschneider/32/33564_2.png) [@ariemenschneider](https://discuss.elastic.co/u/ariemenschneider)\
**Post date:** [November 18, 2019, 3:19pm UTC](https://discuss.elastic.co/t/max-file-descriptors-4096-for-elasticsearch-process-is-too-low-running-as-a-service/208238/2 "2019-11-18T15:19:30Z")

</div>

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

```auto
# 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:

```auto
systemctl daemon-reload

```

---

<div class="post-metadata">

**Author:** ![mauriciothomsen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mauriciothomsen/32/36507_2.png) [@mauriciothomsen](https://discuss.elastic.co/u/mauriciothomsen)\
**Post date:** [November 19, 2019, 6:30pm UTC](https://discuss.elastic.co/t/max-file-descriptors-4096-for-elasticsearch-process-is-too-low-running-as-a-service/208238/3 "2019-11-19T18:30:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 17, 2019, 6:30pm UTC](https://discuss.elastic.co/t/max-file-descriptors-4096-for-elasticsearch-process-is-too-low-running-as-a-service/208238/4 "2019-12-17T18:30:58Z")

</div>

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