Home  >  Q&A  >  body text

mongodb3.x - mongodb数据迁移(mongorestore,mongoimport)出错

我现在想将本地的Mongo数据(50GB)迁移到阿里云上(内存1G)。本地版本是v2.4.9,服务器上是v3.2.11

我在阿里云上部署用mongo v2.x版本的话,就可以将数据恢复成功。

所以可能是 v2到v3 之间的问题,也可能是v3本身的问题?但是感觉后者可能性不大。
求问,如何解决?

巴扎黑巴扎黑2749 days ago856

reply all(2)I'll reply

  • PHP中文网

    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.

    reply
    0
  • 巴扎黑

    巴扎黑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:

    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.

    reply
    0
  • Cancelreply