Cannot increase file descriptor limits

I am trying to increase file descriptor limits using `limits`:

Code:
# sysctl kern.maxfiles kern.maxfilesperproc
kern.maxfiles: 65536
kern.maxfilesperproc: 65536

# limits -H -n
Resource limits (current):
  openfiles               57870
# limits -H -n 65536
Resource limits (current):
  openfiles-max           65536
# limits -H -n
Resource limits (current):
  openfiles               57870

Same thing for -S. What am I doing wrong?
 
Thanks, sorry I do not understand your reply. limits shows that the limit remains at 57850. Currently the only way I have to work around this is that once I start the application that is complaining, I change the limit for that PID with -P.
 
As lebarondemerde told you, try to increase system-wide file descriptors limit with sysctl kern.maxfiles=200000 first.

PS: Out of curiosity, what program needs that many file descriptors?
 
As I wrote in my original message, kern.maxfiles has already been set to 65536. I tried setting it to a higher value, say 1048576, but I have the same issue.

The software is elasticsearch, which even for my small installation apparently has this requirement that cannot be changed unfortunately..
 
There is also sysctl kern.maxfilesperproc=200000. And then it depends on which shell you use. For sh(1) you should use ulimit -n 200000, whereas for csh(1) correct command is limit descriptors 200000.
 
Back
Top