-
Notifications
You must be signed in to change notification settings - Fork 190
Description
The docs on how to set ulimit on Mac OS X (http://docs.basho.com/riak/latest/ops/tuning/open-files-limit/) are out of date. As of Mac OS X 10.10 (Yosemite), the appropriate method is as follows:
Two files need to be created.
First file:
sudo vi /Library/LaunchDaemons/limit.maxfiles.plist
...containing:
<?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>
Second file:
sudo vi /Library/LaunchDaemons/limit.maxproc.plist
...containing:
<?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>
Please confirm that both these files are owned by root:wheel
and have permissions -rw-r--r--
. This should be the default but it's wise to check. The chmod command to do that is sudo chmod 644 <filename>
.
Doing the above will cause system limits to set themselves correctly upon restart. This can be confirmed by typing launchctl limit
into a terminal.
Once system limits are properly set, it remains necessary to set session limits. This is best done by editing bashrc:
sudo vi /etc/bashrc
You need to add the following lines to the end of the file:
ulimit -n 65536
ulimit -u 2048
As with the other files above, make sure the bashrc file has -rw-r--r--
permissions.
After all this is done, restart the computer and type ulimit -n into a terminal. You should see confirmed that the maxfiles is 65536. It is now safe to run riak!
The above method is suitable for computers that are happy to keep a high open files limit in the long run. However, if you wish to change the limit only for the current session, you may skip modifications to files and simply enter the following into the terminal:
sudo launchctl limit maxfiles 65536 65536
sudo launchctl limit maxproc 2048 2048
ulimit -n 65536
ulimit -u 2048
These settings will expire; the ulimit settings upon relaunch of the terminal and the launchctl settings upon restart of the computer.