Database Crashes
When running databases on the Self-Managed Enterprise Edition, you may encounter errors such as "Too many files open". These errors typically occur when the system file descriptor or process limits are too low.
To resolve this, follow the steps below to increase system limits (ulimit
):
Steps to Update System Limits
-
Open the system configuration file:
sudo nano /etc/systemd/system.conf
-
Modify or add the following parameters:
DefaultLimitNOFILE=1048576
DefaultLimitNPROC=1000000
DefaultLimitSTACK=8388608noteThese values were initially unset (empty) and have been updated following MongoDB's best practice recommendations.
-
Reload the system daemon to apply the configuration:
sudo systemctl daemon-reexec
-
Reboot the machine:
sudo reboot
Troubleshooting
-
Changes not taking effect after reboot:
Ensure you edited/etc/systemd/system.conf
(not/etc/systemd/user.conf
), and that there are no syntax errors. -
Still seeing "Too many files open" errors:
Confirm the limits by checking:ulimit -n