mongodump较低版mongodb

时间:2016-04-25 11:28:03

标签: mongodb mongodump

我尝试使用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

1 个答案:

答案 0 :(得分:0)

docs声明以下内容“mongodump从版本2.2或更高版本使用的数据格式与早期版本的mongod不兼容。请勿使用最新版本的mongodump来备份旧数据存储。”

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