I am trying to install mongodb on Ubuntu EC2 instance. However, I am confused about what user the DB would run as:

If I follow: http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/

Then it says : "mongodb"

If I follow : http://docs.mongodb.org/ecosystem/tutorial/install-mongodb-on-amazon-ec2/

It says : "mongod"

I think it leads me to inconsistent state. There was a process running is ps output for mongodb but sudo service mongodb status or stop says: Unknown Instance.

What should be the user of mongodb?


The reason for the difference is that the articles describe two different versions of Linux. For the install MongoDB on Ubuntu tutorial you are talking about Ubuntu. If you are following the install MongoDB on Amazon EC2 tutorial then you are talking about Amazon Linux.

Ubuntu uses deb/apt based packages (which gets you the mongodb user) and Amazon Linux uses rpm/yum based packages (which gets you the mongod user). You are using Ubuntu according to your question, hence the relevant user for you is "mongodb".

I would point out though, that this likely has nothing to do with the issue you are having with the service status or shutting it down. That's more likely some sort of problem with the wrong PID being referenced by upstart, or possibly an issue with MongoDB starting in the first place (check your logs).

I would recommend:

  1. Stop MongoDB manually (log in with the mongo shell and issue the shutdown command)
  2. Start the service again, with sudo service start mongodb
  3. Verify that it started correctly (logs, login with the mongoshell again)
  4. Re-check with sudo service mongodb status
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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