How do I copy a database from one MongoDB server to another?

前端 未结 5 1725
逝去的感伤
逝去的感伤 2020-11-29 21:01

I have two mongodbs in different server, both start with --auth. Now I want to copy a db from one server to another.

> mongo
> use admin
&         


        
5条回答
  •  被撕碎了的回忆
    2020-11-29 21:37

    If you are using --auth, you'll need to include your username/password in there...

    Also you must be on the "destination" server when you run the command.

    db.copyDatabase(, , , , );
    

    If all that doesn't work, you might want to try something like creating a slave of the database you want to copy ...

提交回复
热议问题