简体   繁体   English

mongodb恢复删除的记录

[英]mongodb recovery removed records

I have a two-member replica set, I accidentally removed all documents in an collection, I am not sure how I did this, but it's gone. 我有一个由两个成员组成的副本集,我不小心删除了一个集合中的所有文档,我不确定我是如何做到的,但是它已经消失了。 Is it possible to get all the data back? 是否可以取回所有数据?

Unless you have a backup (always recommended for just this type of thing), or one of the replicas is using slavedelay , then I am afraid the removal of the records is final. 除非您有备份 (总是建议仅用于这种类型的事情),或者其中一个副本正在使用slavedelay ,否则恐怕记录的删除是最终的。 You might have been able to force a shutdown in time to save the data on-disk if you killed the process before the next fsync to disk (similarly if you broke replication before the removal was replicated), but even then it would be tricky. 如果您在下一个fsync到磁盘之前杀死了进程,则可以及时关闭磁盘以将数据保存在磁盘上(类似的情况是,如果在复制删除内容之前中断了复制操作),但是即使那样,这还是很棘手的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM