Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (47.6k points)

I've been using mongo on my mac os x 10.8 and suddenly yesterday at my logs appeared this warning (and when starting shell it's present too) -

WARNING: soft rlimits too low. Number of files is 256, should be at least 1000

Who could explain, what does it mean? And should I increase the number of rlimits somehow?

2 Answers

0 votes
by (106k points)

You can ignore this warning on the mac, probably you must have using mongodb for development purposes. 

0 votes
by (108k points)

For solving your query, you have to check two files:

The first file will be in your the following directory: 

sudo vi /Library/LaunchDaemons/limit.maxfiles.plist

That contains the following code:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

<plist version="1.0">

<dict>

<key>Label</key>

<string>limit.maxfiles</string>

<key>ProgramArguments</key>

<array>

<string>launchctl</string>

<string>limit</string>

<string>maxfiles</string>

<string>65536</string>

<string>65536</string>

</array>

<key>RunAtLoad</key>

<true/>

<key>ServiceIPC</key>

<false/>

</dict>

</plist>

The second file will be in the following directory:

sudo vi /Library/LaunchDaemons/limit.maxproc.plist

That contains the following code:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

<plist version="1.0">

<dict>

<key>Label</key>

<string>limit.maxproc</string>

<key>ProgramArguments</key>

<array>

<string>launchctl</string>

<string>limit</string>

<string>maxproc</string>

<string>2048</string>

<string>2048</string>

</array>

<key>RunAtLoad</key>

<true/>

<key>ServiceIPC</key>

<false/>

</dict>

</plist>

By looking into the files you have to make sure that both of those files must be owned by root:wheel and must have the permissions as -rw-r--r. To check the above mention things just write:

sudo chmod 644 <filename>

By performing the above-mentioned tasks, the system will then set itself correctly when you restart the system. You can confirm this by typing the following command into your terminal:

launchctl limit

This will set your system’s limits. After that you have to add the following syntaxes at the end of the file:

ulimit -n 65536

ulimit -u 2048

And you also have to make sure that the barshrc file must have -rw-r--r-- permission.

At last, you have to restart your computer and open the terminal. Inside the terminal, you have to write ulimit -n. The result must have the maxfiles as 65536.

Now you will be not seeing the soft rlimits warnings when you will be login into your mongo shell. If you wish to learn more about MongoDB, then go through this MongoDB course and be an expert.

Related questions

0 votes
1 answer
0 votes
2 answers
asked Oct 16, 2019 in Web Technology by Sammy (47.6k points)
0 votes
1 answer
0 votes
1 answer
asked Oct 18, 2019 in Web Technology by Sammy (47.6k points)
0 votes
1 answer
asked Sep 6, 2019 in SQL by Sammy (47.6k points)

Browse Categories

...