开发者

Mongodb crashed! Where has my data gone?

开发者 https://www.devze.com 2023-01-15 18:22 出处:网络
Please help! Mongodb crashed on my server. When I started the mongod backup I have no data in database!

Please help!

Mongodb crashed on my server. When I started the mongod backup I have no data in database!

Looking at the data/db/ dir开发者_如何学编程ectory I have the following 5 files:

mongo.lock
production-mongodb       4k
production-mongodb.0     64m
production-mongodb.1     128m
production-mongodb.ns    16m

I think mongo has somehow started a new database, keeping my old one? Hopefully! If this is correct how do I fix this? And what is going on here?

I have tried to remove the lock file and run mongod --repair but still empty database.


What does show dbs show? Did you switch to the correct DB assuming you see "production" listed?


OK, based on the files you've listed, you have one database named "production-mongodb".

So you'll want to run mongod production-mongodb to get command-line access.

Or you can do mongod

use production-mongodb

show collections

You should see your data.

0

精彩评论

暂无评论...
验证码 换一张
取 消