1

So here is my scenario:

  • Today my server was restarted by our hoster (acpi shutdown).
  • My mongo database is a simple docker container (mongo:3.2.18)
  • Because of an unknown reason the container wasn't restarted on reboot (restart: always was set in docker-compose).
  • I started it and noticed the volume mapping were gone.
  • I restored them to the old paths, restarted the mongo container and it started without errors.
  • I connected to the database and it was completely empty.

> show dbs
local  0.000GB
> use wekan
switched to db wekan
> show collections
> db.users.find();
>

Also I already tried db.repairDatabase();, no effect.

Now my _data directory contains a lot of *.wt files and more. (File list)

I found collection-0-2713973085537274806.wt which has a file size about 390MiB.

This could be the data I need to restore, assuming its size.

Any way of restoring this data?

I already tried my luck using wt salvage according to this article, but I can't get it running - still trying.

I know backups,backups,backups! Sadly this database wasn't backuped.

Related GitHub issue, contains details to software.


Update:

I was able to create a .dump file with the WiredTiger Data Engine tool. However I can't get it imported into a mongoDB.

CodeBrauer
  • 2,690
  • 1
  • 26
  • 51
  • This question is answered on https://stackoverflow.com/questions/55117229/restoring-mongodb-using-only-wt-files – mdikici Dec 01 '21 at 15:31

1 Answers1

1

Try running a repair on the mongo db container. It should repair your database and the data should be completely restored.

Start mongo container in bash mode.

sudo docker-compose -f docker-compose.yml run mongo bash

or

docker run -it mongo bash

Once you are inside the docker container, run mongo db repair.

mongod --dbpath /data/db --repair

The DB should repaired successfully and all your data should be restored.

Amir Rajak
  • 21
  • 2