Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ubuntu workaround in docs is missing a step to increase nofile #87436

Open
justincr-elastic opened this issue Jun 6, 2022 · 3 comments
Open
Labels
:Core/Infra/Core Core issues without another label >docs General docs changes Team:Core/Infra Meta label for core/infra team Team:Docs Meta label for docs team team-discuss

Comments

@justincr-elastic
Copy link
Contributor

justincr-elastic commented Jun 6, 2022

https://www.elastic.co/guide/en/elasticsearch/reference/current/system-config.html
https://www.elastic.co/guide/en/elasticsearch/reference/current/setting-system-settings.html
https://www.elastic.co/guide/en/elasticsearch/reference/current/file-descriptors.html

I installed Elasticsearch 8.2.2 from zip archive on Ubuntu 22.04 LTS. The setup instructions in Elasticsearch docs were incomplete for setting nofile. It was not sufficient to set it in limits.conf for user elasticsearch, I also had to add a setting in system.conf and user.conf.

For example:

sudo su - root
ulimit -Sl -Hl                            ## max locked memory 8191692 8191692
echo "elasticsearch soft memlock unlimited"           >> /etc/security/limits.conf
echo "elasticsearch hard memlock unlimited"           >> /etc/security/limits.conf
ulimit -Su -Hu                            ## max user processes 255720 255720
echo "elasticsearch soft nproc   255720"              >> /etc/security/limits.conf
echo "elasticsearch hard nproc   255720"              >> /etc/security/limits.conf
ulimit -Ss -Hs                            ## open files 8192 8192
echo "elasticsearch soft stack   32768"               >> /etc/security/limits.conf
echo "elasticsearch hard stack   32768"               >> /etc/security/limits.conf
ulimit -Sn -Hn                            ## open files 1024 1024
echo "elasticsearch soft nofile  131071"              >> /etc/security/limits.conf
echo "elasticsearch hard nofile  131071"              >> /etc/security/limits.conf
grep LimitNOFILE /etc/systemd/system.conf ## #DefaultLimitNOFILE=1024:524288
grep LimitNOFILE /etc/systemd/user.conf   ## #DefaultLimitNOFILE=1024:524288
echo "DefaultLimitNOFILE=131071:131071"   >> /etc/systemd/system.conf
echo "DefaultLimitNOFILE=131071:131071"   >> /etc/systemd/user.conf 
sysctl -n vm.swappiness                   ## vm.swappiness=1
sysctl -n vm.max_map_count                ## vm.max_map_count=65530
echo "vm.swappiness=1"                    >> /etc/sysctl.conf
echo "vm.max_map_count=262144"            >> /etc/sysctl.conf
init 6
sudo su - root
ulimit -Sl -Hl                            ## max locked memory 8191692 8191692
ulimit -Su -Hu                            ## max user processes 255720 255720
ulimit -Ss -Hs                            ## open files 8192 8192
ulimit -Sn -Hn                            ## open files 1024 1024
sysctl -n vm.swappiness                   ## vm.swappiness=1
sysctl -n vm.max_map_count                ## vm.swappiness=262144
grep LimitNOFILE /etc/systemd/system.conf ## DefaultLimitNOFILE=131071:131071
grep LimitNOFILE /etc/systemd/user.conf   ## DefaultLimitNOFILE=131071:131071
exit
####################################################################################
sudo su - elasticsearch
ulimit -Sl -Hl             # max locked memory unlimited unlimited
ulimit -Su -Hu             # max user processes 255720 255720
ulimit -Ss -Hs             # open files 32768 32768
ulimit -Sn -Hn             # open files 131071 131071
exit

Without the changes in system.conf and user.conf, running ulimit -Sn -Hn as user elasticsearch returned 1024 for the soft and hard nofile limits, even if I put the recommended elasticsearch entries in limits.conf.

@justincr-elastic justincr-elastic added the Team:Docs Meta label for docs team label Jun 6, 2022
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-docs (Team:Docs)

@justincr-elastic justincr-elastic added >docs General docs changes :Core/Infra/Core Core issues without another label labels Jun 6, 2022
@elasticmachine elasticmachine added the Team:Core/Infra Meta label for core/infra team label Jun 7, 2022
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

@justincr-elastic
Copy link
Contributor Author

The missing steps for system.conf and users.conf might belong in an expanded version of this section. For example, that section mentions LimitMEMLOCK, which is spelled similar to the missing DefaultLimitNOFILE settings.

However, I found this statement confusing. It talks about RPM or Debian packages, whereas I uses the tar.gz archives for Linux.

When using the RPM or Debian packages on systems that use systemd, system limits must be specified via systemd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Core/Infra/Core Core issues without another label >docs General docs changes Team:Core/Infra Meta label for core/infra team Team:Docs Meta label for docs team team-discuss
Projects
None yet
Development

No branches or pull requests

3 participants