Centos – How to set ulimits for mongod

centosmongodbulimit

How do I set ulimits for the mongod process/user on CentOS?

I've read the official documentation but it doesn't provide OS-specific instructions.

  • I need to set ulimit -u 64000 and need this to persist after reboot.

  • I'm running CentOS 5.5 although will be upgrading to 6.5 soon.

  • I'd prefer not to modify any scripts installed by the package manager

Best Answer

Modify /etc/security/limits.conf with what you need. Example:

user soft nproc 64000

This line will set the number of processors (-u) to 64000 for "user". Soft/hard limits can be the same (soft allows spikes while hard prevents spawning).