Unable to change max open files for each process using sysctl

My actual limit is 1024:

$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 95979
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 1024
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

I tried:

sysctl -w fs.file-max=100000

and adding to /etc/sysctl.conf:

fs.file-max = 100000

without success even after starting sysctl -pto restart the settings and / or reboot on both Ubuntu 16.04 and CentOS 6.

It is always installed on 1024.


This question is a continuation of this other question .

+5
source share
2 answers

For Ubuntu 17.04. See this solution .

Prior to Ubuntu 17.04:

, , , , , /etc/security/limits.conf.

/etc/security/limits.conf

sudo bash -c "echo '* - nofile 10240' >> /etc/security/limits.conf"
  • * . .
  • - soft, hard . Hard . root , hard.
  • nofile - .
  • 10240 - .

. sudo sysctl -p .

:

ulimit -n

Ubuntu 16.04 CentOS 6. .

+13

MacO 10.14.6 , , :

:

ulimit -n

256

:

ulimit -n 1024

:

ulimit -n

1024.

, "". .

, . , , .

+1

Source: https://habr.com/ru/post/1660721/


All Articles