Mongorestore - too many open files - mac os x

Indeed --numParallelCollections=1 fixed this for me on OS-X, without modifying system settings. I was able to do a full DB restore which previously didn't complete. However it seems to max out the connection pool as I still get 2017-06-01T16:55:19.386+0800 E NETWORK [initandlisten] Out of file descriptors. Waiting one second before trying to accept more connections. when trying to continue. required to restart mongod


I use this alias to startup mongod with different env settings and it solves any problems so far:

ulimit -n 1024 && mongod


It's much safer to change the limit only on the current shell session. Adding it to your bash profile is also an option if you need to have it on every bash console session.

ulimit -S -n 2048
your_whatever_greedy_command...

You may modify 2048 with another value. If your greedy command is starting mongo, it will be:

ulimit -S -n 2048 && mongod

Tags:

Macos

Mongodb