I\'ve installed the mongodb 2.0.3, using the mongodb-10gen debian package. Everything went well, except the service which is installed by default is not starting up when com
I had issue that starting the service mongodb failed, without logs. what i did to fix the error is to give write access to the directory /var/log/mongodb for user mongodb
Install mongodb for ubuntu 14.04
sudo nano /etc/apt/sources.list.d/mongodb-org-3.2.list
echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
sudo apt-get update
sudo apt-get install -y mongodb-org=3.2.10 mongodb-org-server=3.2.10 mongodb-org-shell=3.2.10 mongodb-org-mongos=3.2.10 mongodb-org-tools=3.2.10
sudo -u mongodb mongod --repair --dbpath /var/lib/mongodb/
sudo service mongodb start
Please check your permissions for "data" folder. This is a permission issue, as linux users will face this issue due to SE linux permissions. So you change the ownerand group both to "mongodb" for the "data" folder
1 - disable fork
option in /etc/mongodb.conf
if enabled
2 - Repair your database
mongod --repair --dbpath DBPATH
3 - kill current mongod process
Find mongo processes
ps -ef | grep mongo
you'll get mongod PID
mongodb PID 1 0 06:26 ? 00:00:00 /usr/bin/mongod --config /etc/mongodb.conf
Stop current mongod process
kill -9 PID
4 - start mongoDB service
service mongodb start
I took a different approach:
Background: I use mongodb, single node, local to my server, as a staging area.
I installed mongo based on instructions available in MongoDB docs.
So, this is not 'prime' infrastructure, does not need to be up all the time - but still essential.
What I do: In my run script, I check if mongo is running using -
if pgrep "mongod" >/dev/null 2>&1
If it is not running, then I run
sudo mongod &
Been working like a charm, no setup etc.
If your use case is similar, let me know if it works for you too.
Good luck!