We have moved to www.dataGenX.net, Keep Learning with us.

Thursday, June 04, 2015

Error - mongod shell doesn't start, /data/db doesn't exsist


Error - mongod shell doesn't start, /data/db doesn't exsist


If you face this error while starting MongoDB (mongod), most probably there are 2 reasons for this -

a.  /data/db is not exist at all
b. mongod process don't have access on /data/db

Solution :-


The default db path for mongodb is /data/db/.
So when you run:


mongod



MongoDB checks if /data/db/ is present and if the user has access to it. In your case, there is no such directory and hence the error. So resolution of this error is -

 Create /data/db for mongoDB and give appropriate access :

 $ mkdir -p /data/db
 $ chmod -R 775 /data/db
 # if you concerned about the db security then -
 $ chown -R user:group /data/db      # user/group - mongodb user/group which you want to give access



If you dont want to use default db ( /data/db ), create your own db and pass the path with mongod command : -

$ mkdir -p /app/MongoDataBase
$ chmod -R 775 /app/MongoDataBase
# if you concerned about the db security then -
 $ chown -R user:group /app/MongoDataBase      # user/group - mongodb user/group which you want to give access



Now start the MongoDB with below command :

mongod --dbpath /app/MongoDataBase




Like the Facebook Page & join Group
https://www.facebook.com/DataStage4you
https://www.facebook.com/groups/DataStage4you

https://twitter.com/datastage4you
https://groups.google.com/d/forum/datastage4you
For WHATSAPP group , drop a msg to 91-88-00-906098






No comments :

Post a Comment