1

我们已经实现了 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

4

2 回答 2

5

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

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

mongod --repair --dbpath /path/to/data/db

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

于 2018-02-24T23:39:56.710 回答
2

就我而言,我已经从 Time Machine 恢复了 mac。我通过 brew install 安装了 mongodb。当我启动 mongo 时,服务没有干净地启动。

vi /usr/local/var/log/mongodb/mongo.log
enter code here
2020-01-30T17:06:10.655-0500 E  STORAGE  [initandlisten] WiredTiger error (0) [1580421970:655376][62181:0x112233dc0], file:WiredTiger.wt, connection: __wt_block_read_off, 283: WiredTiger.wt: read checksum error for 4096B block at offset 12288: block header checksum of 0x325e318 doesn't match expected checksum of 0x65ef0e12 Raw: [1580421970:655376][62181:0x112233dc0], file:WiredTiger.wt, connection: __wt_block_read_off, 283: WiredTiger.wt: read checksum error for 4096B block at offset 12288: block header checksum of 0x325e318 doesn't match expected checksum of 0x65ef0e12

我看到的是因为一个损坏的 mongodb 集合。因此,我为 brew install 运行了 cleanup 命令,它的 db 位于不同的位置。

mongod --repair --dbpath /usr/local/var/mongodb

    2020-01-30T17:06:11.741-0500 I  STORAGE  [initandlisten] Verify failed on uri table:collection-12--8361386101775862971. Running a salvage operation.
2020-01-30T17:06:11.745-0500 I  STORAGE  [initandlisten] Repairing collection wlchat.jobs
2020-01-30T17:06:11.765-0500 I  STORAGE  [initandlisten] WiredTiger progress WT_SESSION.verify 100
2020-01-30T17:06:11.769-0500 I  STORAGE  [initandlisten] WiredTiger progress WT_SESSION.verify 200
2020-01-30T17:06:11.774-0500 I  STORAGE  [initandlisten] WiredTiger progress WT_SESSION.verify 300
2020-01-30T17:06:11.783-0500 I  STORAGE  [initandlisten] WiredTiger progress WT_SESSION.verify 400
2020-01-30T17:06:11.789-0500 I  STORAGE  [initandlisten] WiredTiger progress WT_SESSION.verify 500
2020-01-30T17:06:11.793-0500 I  STORAGE  [initandlisten] WiredTiger progress WT_SESSION.verify 600
2020-01-30T17:06:11.795-0500 I  STORAGE  [initandlisten] Verify succeeded on uri table:collection-10--8361386101775862971. Not salvaging.
2020-01-30T17:06:11.795-0500 I  STORAGE  [initandlisten] Repairing collection wlchat.SovrenJobs
2020-01-30T17:06:11.801-0500 I  STORAGE  [initandlisten] Verify succeeded on uri table:collection-0-8794251073515214768. Not salvaging.
2020-01-30T17:06:11.814-0500 I  INDEX    [initandlisten] index build: starting on wlchat.users properties: { v: 2, key: { _id: 1 }, name: "_id_", ns: "wlchat.users" } using method: Foreground

并重新启动 mongodb-community

brew services restart mongodb-community.
==> Successfully started `mongodb-community` (label: homebrew.mxcl.mongodb-community)

事情又恢复了正常。

于 2020-01-30T22:15:20.247 回答