I've been trying to use Mongoid with Rails on Ubuntu. Mongodb was working fine for me with rails app 3.0 to 3.2.
Today suddenly, I am getting an error:
/home/pravinmishra/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.5.2/lib/mongo/connection.rb:413:in `connect': Failed to connect to a master node at localhost:27017 (Mongo::ConnectionFailure)
Many times I faced this issue, and the commands below worked for me:
sudo rm /var/lib/mongodb/mongod.lock
sudo -u mongodb mongod -f /etc/mongodb.conf --repair
sudo start mongodb
sudo status mongodb
When I'm connecting from Ubuntu terminal using mongo then I get this error:
MongoDB shell version: 2.0.1 connecting to: test Mon Jul 9 22:47:06 Error: couldn't connect to server 127.0.0.1 shell/mongo.js:84 exception: connect failed
Any suggestion would be appreciated.