How to raise max threads for elasticsearch?

7,521

Solution 1

Ok, I finally found it. The key was in this blogpost: https://fredrikaverpil.github.io/2016/04/27/systemd-and-resource-limits/

The solution was to edit the file /usr/lib/systemd/system/elasticsearch.service and add the line

LimitNPROC=2048

Solution 2

We ran into this issue also and it turned out to be a systemd service override file that we likely created when originally setting up elasticsearch.

The override file is referenced here in the docs: https://www.elastic.co/guide/en/elasticsearch/reference/current/setting-system-settings.html#systemd

Check /etc/systemd/system/elasticsearch.service.d/ for any conf files and either remove them or update them with the correct LimitNPROC= for your elasticsearch version.

Share:
7,521

Related videos on Youtube

Bart van den Burg
Author by

Bart van den Burg

Updated on September 18, 2022

Comments

  • Bart van den Burg
    Bart van den Burg almost 2 years

    I have a fresh installation of Ubuntu 16.04 and I installed elasticsearch 5 on it. Now when I try to start elasticsearch using

    /etc/init.d/elasticsearch start
    

    After a few seconds in the log file I read:

    [2016-11-19T08:47:31,442][ERROR][o.e.b.Bootstrap          ] [shooter-1] node validation exception
    bootstrap checks failed
    max number of threads [1891] for user [elasticsearch] likely too low, increase to at least [2048]
    

    After some googling, I came to the conclusion that I had to add the following line to /etc/security/limits.conf:

    elasticsearch    -       nproc           2048
    

    However, even after this change, I still get the same error.

    I found a suggestion to uncomment the line

    session    required   pam_limits.so
    

    in /etc/pam.d/su, but that line was already uncommented.

    What am I missing?

  • Srikanth Jeeva
    Srikanth Jeeva almost 7 years
    hmm.. this is already set. but im still facing the error.