Category: ulimit

Mongo error : “Two many open files”, mongod server doesn’t start

Solution 1(temporary and tested):

If you’re using bash, ulimit -n will only display the soft limit. To get the hard limit, you need to do ulimit -Hn.

On my system, I see this:

$ ulimit -n
1024

Set ulimit value to new value as following:

$ ulimit -Hn
4096

ulimit -n <value> (this will only set for current session, better do it in a screen mode and run it in background)

More info: Here

Solution 2 (permanent and not tested):

Modify /etc/security/limits.conf with what you need.

Example:

user soft nproc 64000

Restart machine to make the changes effective.

More info: Here