changing open files system limitations for the use of mongodb

Hi,

I am using a 15' macbook pro retina with os x 10.8.3, I want to change the system limitation on open files (enable to use mongodb) it is now set to 256, and I wanted to know which value should I change it to? (what is recommended).


Thank's.

MacBook Pro with Retina display, OS X Mountain Lion (10.8.3)

Posted on May 30, 2013 8:32 AM

Reply
4 replies

May 30, 2013 8:59 AM in response to The dod

This is done in by modifying the lauchd configuration. You can set the maximum number of open files by running the following command in the Terminal:


sudo launchctl limit maxfiles SOFTLIMIT HARDLIMIT


Change the soft limit and hard limit numbers accordingly, or use "unlimited" to specify no limit.


Try this with your current setup, and if you find a value that works for your needs then you can create a launchd configuration file in /etc/ by running the following command:


sudo pico /etc/launchd.conf


In the editor, place the following as a single line in the file:


limit maxfiles SOFTLIMIT HARDLIMIT


...then press Control-O to save, and Control-X to exit, and then reboot to have this value be used.


The default value of "256 unlimited" is the recommended value for this setting, but if you're running into limits with your database then try doubling it until you get to a value that works.

May 30, 2013 9:02 AM in response to The dod

As a precaution, be sure to keep the hard limit set to "unlimited" and only adjust the soft limit. To do this you will need to specify both values. If you use just one value then I believe both will be set to this value, and you can freeze your system if you do so.


You also might just use the "sudo" command I mentioned above to test the setup, before you apply it to any configuration files. This will ensure if you do experience a crash or hang, that it will revert when you restart your computer.

May 30, 2013 9:52 AM in response to Topher Kessler

When trying the commend:

sudo launchctl limit maxfiles 1024 unlimited

I get the next error :

Neither the hard nor soft limit for "maxfiles" can be unlimited. Please use a numeric parameter for both.

So what is the value I should give for the

HARDLIMIT
?

I don't know if it's true but I read that once you spacify a

HARDLIMIT value
you can not change it to a greater value. Therefor I don't want do any mistakes here.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

changing open files system limitations for the use of mongodb

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.