• [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

  • 相关阅读:
    VA对于开发QT是神器,VA自动补全QT
    64位下好神奇啊(增加了PatchGuard技术保护自己,SSDT是相对地址,参数通过寄存器与rdi来传递)
    贵在坚持
    VC程序查错之内存访问异常
    QT源码解析(一) QT创建窗口程序、消息循环和WinMain函数
    QTimer源码分析(以Windows下实现为例)
    Go语言的优点(oschina讨论)
    致诸位新程序员:来自Chuck Jazdzewski慈父般的忠告
    poj1483 It's not a Bug, It's a Feature!
    App应用与思考
  • 原文地址:https://www.cnblogs.com/xiaoboCSer/p/5220881.html
Copyright © 2020-2023  润新知