Vagrant up on existing server can not connect to mongo db : { [MongoError: connect ECONNREFUSED] name: 'MongoError', message: 'connect ECONNREFUSED' }

Posted by Matt Bryson on 26-Aug-2015 16:37:33
Find me on:

We often get an issue with our MEAN vagrant dev environments where a previously working server will fail to connect to the mongo db the next time a developer does vagrant up

It appears if the vagrant server is abruptly shutdown (host power down for example), mongo does not gracefully disconnect and you get a corrupted mongo lock file. Until we work out a way to stop this happening our workaround is to simply kill the lock file and re start mongo...

 vagrant ssh

Then on the vagrant server thats hosts mongo....

sudo rm /var/lib/mongodb/mongod.lock && sudo service mongodb restart


Topics: MongoDB, Linux, Vagrant, Bash

About the author

Matt Bryson is an experienced systems engineer with over 15 years Development and Systems Operations experience.

Product Briefing

In this short product briefing, see how iDetailAid customers are simplifying the creation, update, localisation and upload of CLM content.

New Call-to-action

Subscribe to Email Updates

Recent Posts