0

I am seeing something weird that I can not figure out:

If i run the following command

sudo mongod --dbpath /db/database/ --logpath /db/logs/mongodb/mongodb.log &

and then do a

ps aux

I see the following

enter image description here

So I have two mongod processing running now (ignore the third with the --configsrv option)

Why is this happening?

  • I think the nature of the processes is answered below, but I will say this: do not start MongoDB as root, do not use sudo to run MongoDB - or any database for that matter - it is a bad, bad idea. If you switch to another user, as you should, you will have to manually fix the ownership on the various data files before the new user will be able to successfully start. – Adam C Nov 14 '13 at 22:34
1

2137 is not a mongod process, it is a sudo process and mongod ... are the arguments to sudo.

I think it is probably sticking around because mongod is leaving some file descriptors open.

Try doing ps -e f and you will see the process tree view.

If you really want that sudo to exit you could try something trickier like

sudo sh -c 'mongod --dbpath blah blah &'

and see if that works. Good luck, let us know what you find!

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.