0
votes

Hi, Am editing dbpath of running mongodb in 'amazon ubuntu instance'(have more than 30 GB data), and I attached some volumes I for data, log, and joural

I followed mongodb-ec2

  • mount /data , /log and /journal
  • stop mongodb
  • edit /etc/mongodb.conf

mongodb.conf

dbpath=/data

copy all files from old dir to new mount volumes.

  • start mongodb

. For testing I run a python script,

from pymongo import MongoClient

db = MongoClient().my_testdb

I got the error message,

pymongo.errors.ConnectionFailure: could not connect to localhost:27017: [Errno 111] Connection refused

So I remove the lock from the /data/mongod.lock.

and run sudo mongod --repair The following error I got

..........
ERROR: dbpath (/data/db/) does not exist
........

My question is, even though I configured dbpath=/data, why it try to look for the path /data/db? how can I resolve it?

1

1 Answers

3
votes

When you run mongod --repair you are not using your config file at all, so you will need to pass --dbpath as part of the command, e.g.:

mongod --dbpath /data --repair

Or if you wish to use the config file, run:

mongod -f /etc/mongod.conf --repair