semmypurewal / LearningWebAppDev

Examples from the book "Learning Web Application Development".
http://learningwebappdev.com
268 stars 356 forks source link

problem connecting to mongo #71

Open sineau opened 9 years ago

sineau commented 9 years ago

I have problem running mongo. After starting mongodb service, commanding mongo would result: Error: couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:145 ‍‍‍‍‍‍ And running mongod would result: ERROR: dbpath (/data/db/) does not exist. After creating this directory and running sudo mongod, it would hangs on: [websvr] admin web console waiting for connections on port 28017 any help?

semmypurewal commented 9 years ago

Hello! Sorry for the trouble. It sounds like something got corrupted during the VM creation. I'd recommend rebuilding your virtual machine in this case. Basically, try doing the following:

$ vagrant destroy

Then

$ vagrant up

This will remove anything from your shared folders, so make sure you copy anything you want to save somewhere before you do it.

sineau commented 9 years ago

I did the same thing to fix the problem. However I have to manually remove /var/lib/mongodb/mongodb.lock every time I'm going to run mongo.