Hi,
I hope you are doing well. I have an issue if anyone can help please. Actually we have a mongoDB 3.6 running in standalone, something got wrong and we lost the metadata of the DB, now all we got is a directory data with all the colle--.wt and idex-***.wt files. Is there any solution to retrieve the data from those wt files and import them in a new mongoDB instance.
We would be so gratefull if someone can help.
Have a nice day.
Hi, thank you for your reply. Yes only the cool and index et files the other file containing the metadata _md_catalog are lost. Thank you again for your interest.
I recall seeing a post some time back about using wt to dump the collections from the .wt files.
It won’t put it all back together but at least you have the data. I’ll see if I can find it. It did need compiling as the OS and release versions of wt didn’t include snappy compression.
Hi @Aissa_Elaffani,
This problem makes me extremely curious @chris & @Aissa_Elaffani
I tried to simulate your situation in a small way (Unfortunately, in this quick simulation, I am using the 4.4), can you confirm that it is in the following way:
[root@mongodbstandalone mongo]# ls -altrh
totale 488K
drwxr-xr-x 4 mongod mongod 35 2 nov 05.47 ..
-rw------- 1 mongod mongod 21 2 nov 05.47 WiredTiger.lock
-rw------- 1 mongod mongod 50 2 nov 05.47 WiredTiger
-rw------- 1 mongod mongod 114 2 nov 05.47 storage.bson
-rw------- 1 mongod mongod 20K 2 nov 06.24 index-8--5791277203608009656.wt
-rw------- 1 mongod mongod 20K 2 nov 06.24 collection-7--5791277203608009656.wt
-rw------- 1 mongod mongod 36K 2 nov 14.48 index-10--5791277203608009656.wt
-rw------- 1 mongod mongod 36K 2 nov 14.48 collection-9--5791277203608009656.wt
-rw------- 1 mongod mongod 12K 2 nov 15.19 index-5--5791277203608009656.wt
-rw------- 1 mongod mongod 12K 2 nov 15.19 collection-4--5791277203608009656.wt
-rw------- 1 mongod mongod 4,0K 9 nov 22.37 WiredTigerHS.wt
-rw------- 1 mongod mongod 36K 9 nov 22.37 sizeStorer.wt
-rw------- 1 mongod mongod 36K 9 nov 22.37 _mdb_catalog.wt
-rw------- 1 mongod mongod 5 9 nov 22.37 mongod.lock
-rw------- 1 mongod mongod 20K 9 nov 22.37 index-1--5791277203608009656.wt
-rw------- 1 mongod mongod 20K 9 nov 22.37 collection-0--5791277203608009656.wt
-rw------- 1 mongod mongod 36K 9 nov 22.38 index-3--5791277203608009656.wt
-rw------- 1 mongod mongod 36K 9 nov 22.38 collection-2--5791277203608009656.wt
-rw------- 1 mongod mongod 84K 9 nov 22.38 WiredTiger.wt
-rw------- 1 mongod mongod 1,5K 9 nov 22.38 WiredTiger.turtle
drwxr-xr-x 4 mongod mongod 4,0K 9 nov 22.38 .
drwx------ 2 mongod mongod 110 9 nov 22.38 journal
-rw------- 1 mongod mongod 12K 9 nov 22.38 index-6--5791277203608009656.wt
drwx------ 2 mongod mongod 113 9 nov 22.39 diagnostic.data
[root@mongodbstandalone mongo]# rm -rf WiredTiger.lock WiredTiger storage.bson mongod.lock journal WiredTiger.turtle diagnostic.data
[root@mongodbstandalone mongo]# ls -altrh
totale 424K
drwxr-xr-x 4 mongod mongod 35 2 nov 05.47 ..
-rw------- 1 mongod mongod 20K 2 nov 06.24 index-8--5791277203608009656.wt
-rw------- 1 mongod mongod 20K 2 nov 06.24 collection-7--5791277203608009656.wt
-rw------- 1 mongod mongod 36K 2 nov 14.48 index-10--5791277203608009656.wt
-rw------- 1 mongod mongod 36K 2 nov 14.48 collection-9--5791277203608009656.wt
-rw------- 1 mongod mongod 12K 2 nov 15.19 index-5--5791277203608009656.wt
-rw------- 1 mongod mongod 12K 2 nov 15.19 collection-4--5791277203608009656.wt
-rw------- 1 mongod mongod 4,0K 9 nov 22.37 WiredTigerHS.wt
-rw------- 1 mongod mongod 36K 9 nov 22.37 _mdb_catalog.wt
-rw------- 1 mongod mongod 20K 9 nov 22.37 index-1--5791277203608009656.wt
-rw------- 1 mongod mongod 20K 9 nov 22.37 collection-0--5791277203608009656.wt
-rw------- 1 mongod mongod 36K 9 nov 22.38 index-3--5791277203608009656.wt
-rw------- 1 mongod mongod 36K 9 nov 22.38 collection-2--5791277203608009656.wt
-rw------- 1 mongod mongod 36K 9 nov 22.39 sizeStorer.wt
-rw------- 1 mongod mongod 12K 9 nov 22.40 index-6--5791277203608009656.wt
-rw------- 1 mongod mongod 84K 9 nov 22.40 WiredTiger.wt
drwxr-xr-x 2 mongod mongod 4,0K 9 nov 22.41 .
[root@mongodbstandalone mongo]# systemctl status mongod
● mongod.service - MongoDB Database Server
Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled)
Active: failed (Result: signal) since gio 2023-11-09 22:41:06 CET; 16s ago
Docs: https://docs.mongodb.org/manual
Process: 1026 ExecStart=/usr/bin/mongod $OPTIONS (code=killed, signal=ABRT)
Main PID: 1026 (code=killed, signal=ABRT)
nov 09 22:37:56 mongodbstandalone.test.com systemd[1]: Started MongoDB Database Server.
nov 09 22:37:56 mongodbstandalone.test.com mongod[1026]: {"t":{"$date":"2023-11-09T21:37:56.698Z"},"s":"I", "c":"CONTROL", "id":7484500, "ctx":"main","msg":"Environment variable MONGO..." to false"}
nov 09 22:41:06 mongodbstandalone.test.com systemd[1]: mongod.service: main process exited, code=killed, status=6/ABRT
nov 09 22:41:06 mongodbstandalone.test.com systemd[1]: Unit mongod.service entered failed state.
nov 09 22:41:06 mongodbstandalone.test.com systemd[1]: mongod.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
as I said Fabio all what i got right now is the collections and index wt files. but the other files like _mdb_catalog.wt got lost. so right now i am trying to find a solution to restore the data from the wt files without the metada files. idk even if it is possible or not. Thank you for reply.