mongodb3.x - mongodb data migration (mongorestore, mongoimport) error
巴扎黑
巴扎黑 2017-05-02 09:23:08
0
2
888

I now want to migrate local Mongo data (50GB) to Alibaba Cloud (memory 1G). The local version is v2.4.9 and the server is v3.2.11

  • But I use mongodump to export the data, transfer it to Alibaba Cloud and use mongorestore to restore it. When the data is restored to about 1.8%, an error occurs. It may be caused by insufficient memory.
    Error messageFailed: sof.test: error restoring from /root/sof/test.bson.gz: insertion error: EOF

  • I tested the mongoexport/mongoimport commands at the same time and got the same error.

  • I tested again: I installed mongo v3.2 locally on another computer, exported the data on the local v2.4.9 machine, and transferred it to the Alibaba Cloud server (mongo v3. 2.11), the same error occurred in mongorestore.

If I deploy the mongo v2.x version on Alibaba Cloud, the data can be restored successfully.

So it may be a problem between v2 and v3, or it may be a problem with v3 itself? But the latter seems unlikely.
How to solve it?

巴扎黑
巴扎黑

reply all(2)
洪涛

I just tried it. I dumped it from 2.6.6, and then restored it successfully in 2.6.10 and 3.2.11. It shouldn't be a version issue, the versions are all backward compatible.
Maybe it’s a data problem?
I don’t have that big data, so it’s hard to test. Try changing to a smaller watch.

巴扎黑

Read the documentation carefully, cross-version upgrades are clearly prohibited. The correct approach is to upgrade version by version. Two options:

Upgrade to 3.2 locally version by version and then export to remote

Your situation should be: 2.4.9 -> 2.6.x -> 3.0.x -> 3.2.11
Finally, take the data exported in 3.2.11 to mongorestore.

Install 2.4.9 remotely and upgrade to 3.2.11

The process also follows the above process.
Upgrade of each version must be carried out according to the Upgrade Notes of the corresponding version to ensure the correct result in the end.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template