使用mongodb恢复转储失败 [英] restoring a dump with mongodb fails

查看:58
本文介绍了使用mongodb恢复转储失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用以下mongodump命令行转储了mongodb数据库

I've dumped a mongodb database with the following mongodump command line

mongodump -h www.myhost.com -u myusername -p mypassword -d mydb > dump.bson

我正在尝试在本地服务器上还原转储:

And I'm trying to restore the dump on my local server:

mongorestore -h localhost -d mydb dump.bson  

不幸的是,它失败并出现以下错误:

Unfortunately it fails with the following error:

assertion: 10264 invalid object size: 1096040772 

有人知道什么可能导致此错误吗?
在两台服务器上,mongo的版本均为1.8.3

Does anyone know what could cause this error?
On both servers mongo's version is 1.8.3

谢谢

推荐答案

因为从mongodump输出的第一个字符串是启用数据库级别锁定:0"

Because first string output from mongodump is "db level locking enabled: 0"

您需要这样做


tail -n+2 dump.bson > dump_fix.bson
mongorestore -h localhost -d mydb dump_fix.bson

这篇关于使用mongodb恢复转储失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆