It is development environment, Ubuntu 12.04 . Usually I start my mongodb server using the following command.
sudo mongod --dbpath /data/db/ --fork --logpath /var/log/mongodb.log --logappend
Today I tried starting it using
sudo mongod --fork
and then
sudo mongod --fork --logpath /var/log/mongodb.log --logappend
It was not starting.
Then I gave the full command. Still it did not start.
I realized that the directory /data/db was missing(It was existing till yesterday). So I had to create it, and all my data was lost. Other developers in my team has experienced similar problems earlier. I am not sure why the problem is occurring. Is this not the proper way of starting the server?(Even then the data should not be lost).
How to ensure that this will not repeat on the production environment.
sudo service mongodb start
. (the configuration file is/etc/mongodb.conf
) – Eric