简体   繁体   English

来自完整转储的特定数据库的 mongorestore - 安全吗?

[英]mongorestore of specific database from full dump - safe?

I must restore a single Mongodb database from a full backup of many databases without touching the other databases:我必须从许多数据库的完整备份中恢复单个 Mongodb 数据库,而不涉及其他数据库:

eg $ mongorestore --gzip --drop --db ONEDB dbbackupfile例如 $ mongorestore --gzip --drop --db ONEDB dbbackupfile

Will the restore command honour the --db ONEDB and ONLY drop the ONEDB database collection?恢复命令会尊重 --db ONEDB 并且只删除 ONEDB 数据库集合吗? Or will it drop them all?还是会全部丢掉?

[The documentation for mongorestore only says that --drop will drop all collections in the backup - it doesn't say what effect the --db option has on the --drop flag...] [mongorestore 的文档只说 --drop 将删除备份中的所有集合 - 它没有说明 --db 选项对 --drop 标志有什么影响......]

Thank you in advance for your help.预先感谢您的帮助。

I understand the fear of dropping all your databases,我理解删除所有数据库的恐惧,

With that being said the documentation clearly states:话虽如此,文档明确指出:

drops the collections from the target database.从目标数据库中删除集合。

i recommend that if your experimenting with this command for the first time and you're not confident with it yet you should test it not on production but on your local first, or at the very least run it with --dryRun flag just to see if your getting the results you want.我建议,如果您是第一次尝试使用此命令并且对它没有信心,您应该先在本地而不是在生产环境中测试它,或者至少使用 --dryRun 标志运行它只是为了看看如果你得到你想要的结果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM