Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have changed the dbpath of mongodb.conf. And after that trying to start mongodb service,when I run

sudo service mongodb start

I get back

mongodb start/running, process 7320

After that I run:

sudo service mongodb status

And getting back

mongodb stop/waiting

When I want to access mongo shell by :

 mongo
MongoDB shell version: 2.0.4
connecting to: test
Sun Oct 28 13:01:36 Error: couldn't connect to server 127.0.0.1 shell/mongo.js:84
exception: connect failed

But when I start mongod as manually by mongod --dbpath=/mnt/data/db it runs fine. And I can access the mongo shell by mongo command.

I have correct permission for my data directory.

Any clue where I am doing wrong?

share|improve this question

migrated from stackoverflow.com Oct 29 '12 at 17:53

This question came from our site for professional and enthusiast programmers.

2 Answers 2

It is possible that mongodb.conf is not getting loaded because of wrong location (typically this is /etc/mongodb.conf) or a typo when you launch through service start

Try launching manually

mongod --config /etc/mongodb.conf

to rule out any issues with the conf file.

share|improve this answer
    
no issue with conf file,it works fine when I do mongod --config /etc/mongodb.conf –  arnold Oct 28 '12 at 17:16

Also check the owner of the old path and compare it to the owner of the new path with ls -la. It's possible that you created the new dbpath as a different user than mongodb runs as, so you would need to use chown to change the owner.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.