0

我尝试使用 mongodump(版本 3.2.5)备份 MongoDB(版本 2.4.9)。它成功了。但我无法恢复此备份。为什么?

./mongorestore -h 127.0.0.1 -u xxx -p xxx --dir /home/jonkyon/mongo_2 --authenticationDatabase admin --drop

2016-04-25T19:08:24.028+0800  building a list of dbs and collections to restore from /home/jonkyon/mongo_2 dir

2016-04-25T19:08:24.029+0800  assuming users in the dump directory are from <= 2.4 (auth version 1)

2016-04-25T19:08:24.030+0800  cannot drop system collection products.system.users, skipping

2016-04-25T19:08:24.031+0800  reading metadata for products.system.users from /home/jonkyon/mongo_2/products/system.users.metadata.json

2016-04-25T19:08:24.031+0800  restoring products.system.users from /home/jonkyon/mongo_2/products/system.users.bson

2016-04-25T19:08:24.032+0800  error: E11000 duplicate key error index: products.system.users.$_id_  dup key: { : ObjectId('570e2f0ca19b9c2cb7e75905') }

2016-04-25T19:08:24.066+0800  restoring indexes for collection products.system.users from metadata

2016-04-25T19:08:24.068+0800  reading metadata for runoob.runoob from /home/jonkyon/mongo_2/runoob/runoob.metadata.json

2016-04-25T19:08:24.070+0800  finished restoring products.system.users (2 documents)

2016-04-25T19:08:24.070+0800  restoring runoob.runoob from /home/jonkyon/mongo_2/runoob/runoob.bson

2016-04-25T19:08:24.070+0800  restoring indexes for collection runoob.runoob from metadata

2016-04-25T19:08:24.071+0800  finished restoring runoob.runoob (2 documents)

2016-04-25T19:08:24.071+0800  restoring users from /home/jonkyon/mongo_2/admin/system.users.bson

2016-04-25T19:08:24.088+0800  Failed: restore error: error running merge command: no such cmd: _mergeAuthzCollections
4

1 回答 1

0

文档指出以下“2.2 或更高版本的 mongodump 使用的数据格式与早期版本的 mongod 不兼容。不要使用最新版本的 mongodump 备份旧数据存储。”

即使您使用的是 mongodb 2.4.9,我认为您应该避免将最新版本的 mongodump 与旧数据存储一起使用

于 2016-09-03T21:51:14.187 回答