[Mongo] error inserting documents: BSONObj size is invalid (mongoimport mongorestore 数据备份恢复)...

解决办法如下, ./mongoimport -port 6066 -d xxx -c xxx --batchSize=10 /root/mong_data/test/xxx

 

原因转自 http://blog.csdn.net/xiaobluesky/article/details/50216927

 

从MONGODB2.6升级到MONGODB3.0.7,从MONGODB3.0 RESTORE 2.6DUMP的文件时,报如下错误:2015-11-05T10:31:30.131+0800 I NETWORK [conn12] AssertionException handling request, closing client connection: 10334 BSONObj size: 17794400 (0x10F8560) is invalid. Size must be between 0 and 16793600(16MB) GOOGLE之后看到解决方案 I had same problem with mongo 3.0.0 and 3.1.9 with relatively small database (12GB). After wasting roughly 4 hours of time on this I found workaround using hidden parameter mongorestore --batchSize=10 where number varies depending on nature of your data. Start with 1000.

--------------------------------------------------------------------------------------------

alternatively you can use the 3.0.7 version of mongorestore as long as you pass a smallish batch size. The actual value depends on your document sizes, so I can't give you an actual recommended value. The default, what's being used if you don't specify anything, is 10,000.You could try --batchSize=1000 and see if that works for you. If that still fails, you could halve that value until it succeeds.

--------------------------------------------------------------------------------------------------------------------------------

mongorestore send insert commands by batch in a {"applyOps", entries} document. This document is (AFAIK) limited to 16MB just like any other document.According to the sources there are "pathological cases where the array overhead of many small operations can overflow the maximum command size". The variable oplogMaxCommandSize is used to help mongorestore to not fail on such cases. It was raised to 16.5M at some point during the 3.0... development. That was too optimistic. It was lowered back to 8M later (JIRA TOOLS-754).If you need to, you may adjust that value yourself according to your needs. And then recompile the tools.

-------------------------------------

官方BUG链接:https://jira.mongodb.org/browse/TOOLS-939

转载于:https://www.cnblogs.com/xiaoboCSer/p/5220881.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值