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:
- Stop MongoDB manually (log in with the mongo shell and issue the shutdown command)
- Start the service again, with
sudo service start mongodb
- Verify that it started correctly (logs, login with the mongoshell again)
- Re-check with
sudo service mongodb status
As the page you linked implies, any point in time snapshot technique that includes the data files and the journal will suffice, LVM is just one option. EBS snapshots in Amazon EC2 will also work, as will similar snapshot solutions on SAN, NAS etc. You are not limited to LVM, but that is generally a solution people can implement themselves.
In terms of whether you can copy files to perform a backup, the answer is yes, but only if you stop all writes to the node you are backing up (thereby guaranteeing no changes to the files during the copy). You can do this in a couple of ways:
The most straight forward way is to just shut the node (this should be a secondary) down, copy the files, then start the node back up and let it catch up to the primary (check optime using rs.status()
). Rinse and repeat (if you wish) to cycle through all nodes in the set, though the nodes are all identical, so one copy should generally be enough.
The second way (mentioned by sysadmin1138) is to fsync (flush data to disk) and lock (prevent writes) the node but leave it running using the fsyncLock
command (again, this should be a secondary). Once you have completed the copy, you unlock the database using the fsyncUnlock
command. There are dangers inherent in this technique - for example (and particularly if you are using authentication), you should always lock and unlock on the same connection, otherwise you risk locking yourself out of the database and having to kill the process to recover.
As for other risks, it is common to use a hidden node for backups in each case, which prevents accidentally attempting reads from the node while it is behind, and/or while it is locked (depending on your methods).
Finally, there is one further (paid) option - MMS Backup. This service will essentially do all this for you (for a fee) and give you extras like point-in-time recovery and more - note: I work for MongoDB so I won't give you the hard sell here, but feel free to evaluate it yourself.
Best Answer
No its not necessary to uninstall. I don't really like yum or apt for installing mongoDB. I suggest you to download the binaries from https://www.mongodb.org/dl/linux/x86_64 , linux/mongodb-linux-x86_64-ubuntu1404-3.1.0.tgz (or the v12) and use it to start mongodb.