我现在想将本地的Mongo数据(50GB)迁移到阿里云上(内存1G)。本地版本是v2.4.9,服务器上是v3.2.11
但是我使用mongodump将数据导出,传到阿里云上后用mongorestore恢复,恢复到1.8%左右就会出错。应该是内存不足引起的。
错误提示Failed: sof.test: error restoring from /root/sof/test.bson.gz: insertion error: EOF
我同时测试了mongoexport/mongoimport命令 都是同样的错误。
我又进行了再次测试:我本地用另一台电脑装了mongo v3.2版本的,将本地v2.4.9机子上的数据导出来,传到阿里云服务器(mongo v3.2.11)上,mongorestore出现同样的错误。
所以可能是 v2到v3 之间的问题,也可能是v3本身的问题?但是感觉后者可能性不大。
求问,如何解决?
PHP中文网2017-05-02 09:25:08
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.
巴扎黑2017-05-02 09:25:08
Read the documentation carefully, cross-version upgrades are clearly prohibited. The correct approach is to upgrade version by version. Two options:
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.
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.