Reputation: 2383
I was running a Rails rake task overnight on my local machine in order to seed my Mongo collection. It had probably generated about 45,000 records before I received the following exception:
Operation failed with the following exception: connection closed
Failed to connect to a master node at localhost:27017
I am on a Mac OS X, so I attempted mongo
and received the following:
Error: couldn't connect to server 127.0.0.1 shell/mongo.js:84
exception: connect failed
So I ran mongod
thinking that this would simply start up the process. It now appears to have indexed new collections, because all of them are empty. Did I overwrite them, or might they still exist somewhere?
I ran ls /data/db
and I see myapp_development.0
and myapp_development.ns
. Does that tell me anything?
Upvotes: 1
Views: 1838
Reputation: 65433
Sounds like your MongoDB data directory was set to somewhere other than the default (/data/db). Restarting would likely have started mongod with the correct --dbpath.
For example, if you followed a MAMP install guide the suggestion may have been to put the data directory inside /Applications/MAMP/db/mongo.
You should be able to find the dbpath used by running the following command in the mongo JS shell:
db.adminCommand('getCmdLineOpts')
Look for a parsed setting for "dbpath".
Upvotes: 2