spitfire109
spitfire109

Reputation: 10039

Mongodb is not working upon restart in rails app

I had to force a restart of my linux computer and upon turning back on, nothing related to my Mongodb installation is functioning properly.

My rails app, using Mongoid, is giving this error:

Could not connect to any secondary or primary nodes for replica set <Moped::Cluster nodes=[<Moped::Node resolved_address="127.0.0.1:27017">]>

on attempting to load a page and a similar error in the rails console.

Everything was running smoothly before and I am not sure how to right this ship.

Upvotes: 1

Views: 976

Answers (2)

Arvind
Arvind

Reputation: 2781

i don't know it is right or wrong way but it always work for me

rm /data/db/mongod.lock

mongod --dbpath /data/db --repair

mongod --dbpath /data/db

Upvotes: 0

Zach Kemp
Zach Kemp

Reputation: 11904

I generally get this error when the mongo daemon is not running. Try running something like this:

sudo mongod --fork --logpath /var/log/mongodb.log --logappend

The method used to automatically start on system boot will vary depending on your OS. What flavor of Linux do you run?

Upvotes: 3

Related Questions