My database became corrupted. First it started with this error message when I tried to create a new user (we're using meteor-accounts):
getFile(): bad file number value (corrupt db?): run repair
Then I saw in another question that I should run
db.repairDatabase()
but, although mongo shell said that the database was now ok, it didn't really work. The error message above was still showing up.
So I read something about corrupted indexes and dropped the indexes in the
users
collections and this obviously just made everything worse. Now I have two users with the same email address and Meteor doesn't start anymore:MongoError: E11000 duplicate key error index: meteor.users.$emails.address_1 dup key: { : "email@email.com" }
When I try to remove one of these users, the original error shows up again:
meteor:PRIMARY> db.users.remove({ _id: "cAtu2XsEXTbqL2Wvx"})
getFile(): bad file number value (corrupt db?): run repair`
Fortunately we're still on the development phase and we can just drop the whole database and start over, but this has made me really insecure about running Meteor on production environment. Is there any way to fix a database in this state?
Probably more important is to figure out what may have happened to cause this state (to prevent it in the future).
You don't include any information about the version or configuration of your MongoDB - could you please provide all of this information including:
version of MongoDB
OS and version that it's running on
file system being used
options that mongod is being started with (in particular - is it a replica set? are you running with journal disabled, etc).
You should also run
> db.users.validate(true)
on the collection and that may provide additional information about what's in the collection that's problematic.
Lastly, it might help to also see the files in the data path directory (in case any of them got damaged on the file system:
ls -l /path/to/your/db/directory
to compare with validate output in case there are some mismatches.
댓글 없음:
댓글 쓰기