mongodb的data文件夹中内容直接复制到另一个mongodb的data文件夹中,是否可以直接使用呢?
怪我咯
怪我咯 2017-05-02 09:20:01
0
4
980

作为迁移数据库的方法是否可行?

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(4)
黄舟

Not recommended, something may go wrong and you will need to repair. You can use the mongorestore tool that comes with mongo to restore or migrate
Chinese blog
Official documentation

世界只因有你

If you want to copy the entire file, it is possible. For the WT engine, it must also be the entire folder, because WT has its own metadata. Just copying a few collections was useless in the past. MMAPv1 has no metadata, so in theory it is enough to copy all the files corresponding to a library. However, this is not supported and its correctness is not guaranteed.
If you want to copy the entire folder, you must stop access to the entire database. The easiest way is to stop the instance. Of course it is not very practical in actual use, but you can stop dropping a secondary and then perform this operation. If you want to be faster, you can also use disk snapshots without stopping the instance, but the journal must be opened and the journal and data must be on the same disk.
Copying folders works for both WT and MMAPv1.

过去多啦不再A梦

It may not work, and I don’t recommend you do it. Sometimes there will be some unexpected problems. It is recommended to import through tools or commands

曾经蜡笔没有小新

Found some answers, hope they help you:
Migrate mongodb database from localhost to remote servers

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