【发布时间】:2019-02-11 12:20:37
【问题描述】:
我一直在对我的 mongodb 实例进行定期(每 24 小时)备份。这很好用,我可以毫无问题地在我的登台服务器上恢复它们:
time mongorestore --ssl --gzip --authenticationDatabase=admin \
--host=fra-mongo-staging-1.example.com --port=27017 \
--username=restore --password=secret --archive="$snapshot_name"
但生产中的 dbname 是 example_prod,而在登台服务器上我想恢复到 example_staging。所以我输入这个:
time mongorestore --ssl --gzip --db "$dbname" --authenticationDatabase=admin \
--host=fra-mongo-staging-1.example.com --port=27017 \
--username=restore --password=secret --archive="$snapshot_name"
唯一的区别是 --db "$dbname"(其中 $dbname 是 example_staging)。这不起作用:我看到关于准备的行,然后它说完成,但没有恢复。
2019-02-07T11:16:36.743+0000 the --db and --collection args should only be used when restoring from a BSON file. Other uses are deprecated and will not exist in the future; use --nsInclude instead
2019-02-07T11:16:36.772+0000 archive prelude example_prod.surveys
2019-02-07T11:16:36.773+0000 archive prelude example_prod.settings
2019-02-07T11:16:36.773+0000 archive prelude example_prod.spines
2019-02-07T11:16:36.773+0000 archive prelude example_prod.reduced_authors
2019-02-07T11:16:36.773+0000 archive prelude example_prod.delayed_backend_mongoid_jobs
2019-02-07T11:16:36.773+0000 archive prelude example_prod.email_events
2019-02-07T11:16:36.773+0000 archive prelude example_prod.authors
2019-02-07T11:16:36.774+0000 archive prelude example_prod.crowberry
2019-02-07T11:16:36.774+0000 archive prelude example_prod.bitly
2019-02-07T11:16:36.774+0000 archive prelude example_prod.mytestcollection
2019-02-07T11:16:36.774+0000 archive prelude example_prod.reviews
2019-02-07T11:16:36.774+0000 archive prelude example_prod.books
2019-02-07T11:16:36.774+0000 archive prelude example_prod.candy_events
2019-02-07T11:16:36.774+0000 archive prelude example_prod.features
2019-02-07T11:16:36.774+0000 archive prelude example_prod.elderberry
2019-02-07T11:16:36.776+0000 preparing collections to restore from
2019-02-07T11:17:02.403+0000 done
我也尝试过使用--tsFrom=example_prod --tsTo=example_staging,不开心。
对正确的方法有什么建议吗?
【问题讨论】:
标签: mongodb mongorestore