当前位置:网站首页>[North Asia data recovery]_ mdb_ catalog. Mongodb database data recovery case in case of WT file corruption

[North Asia data recovery]_ mdb_ catalog. Mongodb database data recovery case in case of WT file corruption

2022-06-24 18:06:00 North Asia data recovery

 Data recovery in North Asia -MongoDB Data recovery
Environmental Science :
Windows Server Virtual machine ;
MongoDB database .

fault :
Not closed MongoDB In the case of service , After copying the database file to another partition , Format the partition where the original database is located , Then copy the database file back to the original partition , Restart again MongoDB The service was found unable to start . The screenshot of error reporting is as follows :
 Data recovery in North Asia -MongoDB Data recovery
The administrator contacted the North Asia Data Recovery Center for help .

MongoDB Data recovery process :
stay MongoDB When the service is not shut down MongoDB Copy database files , It can lead to mongod.lock and WiredTiger.lock this 2 Error copying files . You can delete these two files in the copied files and then start the service , this 2 Files will be automatically regenerated .

1、 After checking the files copied by the administrator, the data recovery Engineer in North Asia found ,_mdb_catalog.wt file missing .
_mdb_catalog.wt It's stored in the file MongoDB Metadata for all collections in , The database needs to be started from _mdb_catalog.wt Read relevant information from the file . Because of this _mdb_catalog.wt file missing , The database could not get the data corresponding to the collection in the database WT table name 、 Set creation options 、 Metadata such as index information of the collection , Database failed to start .

2、 Data recovery engineers in North Asia try to analyze... From the perspective of file system _mdb_catalog.wt File for recovery .
After scanning the database partition with the self-developed software of North Asia data recovery center, it is found that there is no _mdb_catalog.wt File information . North Asia data recovery engineer according to MongoDB The characteristic values of data files in the database scan the database partition , And I didn't find out _mdb_catalog.wt Relevant data area . From this we can judge ,_mdb_catalog.wt The file has been completely overwritten and destroyed , Can't recover .

3、 Try to extract data from the database level . Deployed by the original server MongoDB The database is based on WiredTiger Storage engine , Data recovery engineers in North Asia use WiredTiger The utility kit extracts data from the database .
download WiredTiger Utility Kit , And then in windows Compile executable in the environment wt Tools .
 Data recovery in North Asia -MongoDB Data recovery

4、 After compilation , Use wt The tool cleans and writes back the data in the collection file of the database , After cleaning and writeback, directly read the data in the file , And write to a .dump In file .

5、 Restore database environment . Data recovery engineers in North Asia re create a MongoDB database , According to the extracted set file , Create a corresponding number of empty collections , And then use wt Tools , What will be extracted dump The files are written to the newly created empty set one by one . At this time, you can query the data in the collection , Confirm the correspondence between these sets and the sets in the metabase , Modify the set name , Rebuild index information .

6、 Due to the existence of... In the original database Gridfs Large fields stored ( file ) aggregate , So by querying the records in the collection , Determine the record type , To determine fs.files and fs.chunks The location of the collection , Then modify the names of the two sets to xxx.files and xxx.chunks, Rebuild set index ,Gridfs Collection recovery complete , You can view the data normally :
 Data recovery in North Asia -MongoDB Data recovery
 Data recovery in North Asia -MongoDB Data recovery

data validation :
After the North Asia data recovery engineer assists in the index reconstruction of all sets , The administrator will query and verify the database as a whole , The data is correct .

原网站

版权声明
本文为[North Asia data recovery]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202211451128993.html