从损坏的 MongoDB 安装中恢复 WiredTiger 集合时出错

San*_*gle 1 linux mongodb wiredtiger

我们已经实现了MongoDB主从复制,数据库被删除了。

我们使用extundelete命令从 Mongo 数据目录中恢复了已删除的文件。

取消删除博客 https://github.com/RIKSOF/development/wiki/Restoring-deleted-files-on-Linux

我们想要恢复至少一个我们获得 WT(有线计时器)文件的集合。我们正在尝试使用以下命令恢复该文件,但出现以下错误

从损坏的 MongoDB 安装中恢复 WiredTiger 集合

wget http://source.wiredtiger.com/releases/wiredtiger-2.7.0.tar.bz2 tar xvf wiredtiger-2.7.0.tar.bz2 cd wiredtiger-2.7.0 sudo apt-get install libsnappy-dev build-essential ./configure --enable-snappy make

./wt -v -h ../mongo-bak -C "extensions=[./ext/compressors/snappy/.libs/libwiredtiger_snappy.so]" -R salvage collection-2657--1723320556100349955.wt

错误 -

./wt -v -h ../mongo-bak -C "extensions=[./ext/compressors/snappy/.libs/libwiredtiger_snappy.so]" -R salvage collection-246--7553069514495955510.wt [1488888117:36780][13536:0x7f7b633cd740], file:WiredTiger.wt, connection: read checksum error for 4096B block at offset 12288: block header checksum of 1955562709 doesn't match expected checksum of 3146787951 [1488888117:36809][13536:0x7f7b633cd740], file:WiredTiger.wt, connection: WiredTiger.wt: encountered an illegal file format or internal value [1488888117:36817][13536:0x7f7b633cd740], file:WiredTiger.wt, connection: the process must exit and restart: WT_PANIC: WiredTiger library panic lt-wt: WT_PANIC: WiredTiger library panic

ken*_*orb 5

根据SERVER-31076错误报告,这可能与损坏的.wt文件(例如WiredTiger.wt/ WiredTiger.turtle)有关。

尝试通过以下命令在所有数据库上运行修复:

mongod --repair --dbpath /path/to/data/db
Run Code Online (Sandbox Code Playgroud)

还要确保所有data/db文件都具有正确的读写权限。