Skip to content

Instantly share code, notes, and snippets.

@samchrisinger
Last active August 29, 2015 14:19
Show Gist options
  • Save samchrisinger/e64b3b30fb433878a674 to your computer and use it in GitHub Desktop.
Save samchrisinger/e64b3b30fb433878a674 to your computer and use it in GitHub Desktop.
Script for fixing "Too many open files" with Mongodb
#!/bin/bash
sudo launchctl limit maxfiles 8096 8096
sudo launchctl limit maxproc 8096 8096
ulimit -n 8096
ulimit -u 1024
@samchrisinger
Copy link
Author

Put this script somewhere on your machine. I like to put my custom scripts in /opt/scripts/. Then

sudo chmod a+x /opt/scripts/limits.sh
sudo ln -s /opt/scripts/limits.sh /usr/bin/limits

Then

sudo limits
inv mongo -d

@HarryRybacki-zz
Copy link

Other useful commands for debugging:

ulimit -a # Display ulimit settings for the current user
launchctl limit # Display the limit settings for the system

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment