In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Method 1: restore through oplog
If you are deploying a MongoDB replication set, there is a glimmer of hope that you can recover the data as much as possible through oplog; every modification of the MongoDB replication set records an oplog, so when the database is mistakenly deleted, you can replay the existing oplog to "recover the data as much as possible". A user I met not long ago was very lucky. The database was created recently, and all the operations are still in oplog, so the user retrieved all the data deleted by mistake through oplog.
The process of recovering data through oplog is very simple, as long as the oplog collection is exported through mongodump and replayed through mongorestore's oplogReplay mode.
Step1: exporting oplog collections
Mongodump-d local-c oplog.rs-d-o backupdir
Step2: copy data from the oplog collection
Mkdir new_backupdircp backupdir/local/oplog.rs.bson new_backupdir/oplog.bson
Step3: playback oplog
Mongorestore-oplogReplay new_backupdir
Method 2: restore through backup set
If you do a full backup + incremental backup of the MongoDB, you can restore the data through the backup set and. Backups can take many forms, such as:
Through mongodump and other tools, copy the logical backup produced by the database, copy the physical backup file system generated by the dbpath directory, the snapshot generated by volume management, etc.
In fact, we can also see a problem here, that is, "Why do you still need to do data backup when you deploy a replication set with multiple nodes?" When you encounter the problem of mistakenly deleting the database, the dropDatabase command will also be synchronized to all standby nodes, causing the data of all nodes to be deleted.
Summary
The above is the recovery method after the Mongodb database is mistakenly deleted. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply you in time. Thank you very much for your support to the website!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.