Uploaded image for project: 'MongoDB Database Tools'
  1. MongoDB Database Tools
  2. TOOLS-1059

[3.2.1] BSONSize error is being raised when calling mongorestore for restoring db content on another host

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • 3.2.1
    • mongorestore
    • None
    • Docker version 1.9.1, build a34a1d5

      Linux 0f123aee2a20 4.2.0-16-generic #19-Ubuntu SMP Thu Oct 8 15:35:06 UTC 2015 x86_64 GNU/Linux

    Description

      root@34cb7ebaa5a5:/tmp# mongorestore -h mongo:27017 dump
      2016-02-02T08:24:36.106+0000 building a list of dbs and collections to restore from dump dir
      2016-02-02T08:24:36.108+0000 reading metadata for testSite.positions from dump/testSite/positions.metadata.json
      2016-02-02T08:24:36.108+0000 restoring testSite.positions from dump/testSite/positions.bson
      2016-02-02T08:24:36.109+0000 Failed: testSite.positions: error restoring from dump/testSite/positions.bson: reading bson input: invalid BSONSize: 825242160 bytes

      When calling mongorestore [3.2.1] for a different host/docker container, I get the above error/stacktrace.

      However, when calling mongorestore to update the same host or when using MongoDB shell version: 3.1.9 to update between different hosts(with 3.1.9), the proper database updates as expected

      STR:
      -Create a docker container by running `docker run -d --name mongo mongo:latest`

      -Create a second docker container by running `docker run -it -v /tmp/dump:/tmp/dump --name mongorestore --link mongo:mongo debian:wheezy`

      Run these commands inside of the mongorestore container (can also be found in the latest mongo Dockerfile

      -apt-get update
      -apt-get install -y --no-install-recommends ca-certificates curl numactl
      -gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4
      curl -o /usr/local/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/1.6/gosu$(dpkg --print-architecture)"
      curl -o /usr/local/bin/gosu.asc -SL "https://github.com/tianon/gosu/releases/download/1.6/gosu$(dpkg --print-architecture).asc"
      -gpg --verify /usr/local/bin/gosu.asc
      -rm /usr/local/bin/gosu.asc
      -chmod +x /usr/local/bin/gosu
      -apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys "DFFA3DCF326E302C4787673A01C4E7FAAAB2461C"
      -apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys "42F3E95A2C4F08279C4960ADD68FA50FEA312927"
      -echo "deb http://repo.mongodb.org/apt/debian wheezy/mongodb-org/3.2 main" > /etc/apt/sources.list.d/mongodb-org.list
      -apt-get update
      -apt-get install -y mongodb-org=3.2.1 mongodb-org-server=3.2.1 mongodb-org-shell=3.2.1 mongodb-org-mongos=3.2.1 mongodb-org-tools=3.2.1

      Copy some of your mongodb backup files to /tmp/dump on the host system

      • Run `mongorestore -h mongo:27017 dump`

      Note: You will see an error message similar to the one above

      Attachments

        Activity

          People

            gabriel.russell@mongodb.com Gabriel Russell (Inactive)
            deuvarney@yahoo.com Deuvarney Sanderson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: