I have a quick question regarding soft and hard limits when working with MongoDB. My understanding is that I need 64000 for both NOFILE and NPROC which is set within the file: /lib/systemd/system/mongod.service
Do I also need to make sure the ulimit is also set to match for the user which is listed in that service file? MongoDB creates a user and group called mongodb.
I wasn’t sure if I needed to have both changed - one with the process as per the service file, and also with the user which runs the service which is this case is mongodb as per ps aux | grep mongodb
Within the limits.config file only using * works to change, but it does it for all users. Typing:
mongodb soft nproc 64000
mongodb hard nproc 64000
I’m not sure this does anything as well. I guess I should just use @ for the group instead? I also don’t know how to check the ulimit for the user mongodb as I cannot switch to it, or check anything as it will say: This account is currently not available as there is no valid shell for this user. Which I believe is done for security reasons as mongodb wont have login privileges?
I just wasn’t sure if I need to set this up for both the service along with the user which runs the service because if I had a user with say 1 for the nproc it of course wouldn’t be able to function.