Firestore新数据库-如何备份 [英] Firestore new database - How do I backup
问题描述
google firestore数据库服务是否提供备份? 如果是这样,如何备份数据库以及如何在发生错误的情况下还原?
Does the google firestore database service provides a backup? If so, how do I backup the database and how do I restore in case of an error?
推荐答案
更新:现在可以使用Cloud Firestore托管的导出和导入服务备份和还原Firebase Firestore
Update: It is now possible to backup and restore Firebase Firestore using Cloud Firestore managed export and import service
您可以通过以下方式做到:
You do it by:
-
为您的项目创建Cloud Storage存储区-确保这是我们中心1或2/多区域类型的存储桶中的区域
Create a Cloud Storage bucket for your project - Make sure it's a regional in us-central1 or 2 / multi regional type of bucket
使用gcloud config set project [PROJECT_ID]
导出
全部导出
gcloud firestore export gs://[BUCKET_NAME]
或导出特定收藏集,使用
gcloud firestore export gs://[BUCKET_NAME] --collection-ids='[COLLECTION_ID_1]','[COLLECTION_ID_2]'
导入
全部导入
gcloud firestore import gs://[BUCKET_NAME]/[EXPORT_PREFIX]/
[BUCKET_NAME]和[EXPORT_PREFIX]指向导出文件的位置.例如-gcloud firestore import gs://exports-bucket/2017-05-25T23:54:39_76544/
Import all by calling
gcloud firestore import gs://[BUCKET_NAME]/[EXPORT_PREFIX]/
where [BUCKET_NAME] and [EXPORT_PREFIX] point to the location of your export files. For example - gcloud firestore import gs://exports-bucket/2017-05-25T23:54:39_76544/
导入特定的收藏集,方法是:
gcloud firestore import --collection-ids='[COLLECTION_ID_1]','[COLLECTION_ID_2]' gs://[BUCKET_NAME]/[EXPORT_PREFIX]/
此处提供完整说明: https://firebase.google.com/docs/firestore/manage-data/export-import
Full instructions are available here: https://firebase.google.com/docs/firestore/manage-data/export-import
这篇关于Firestore新数据库-如何备份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!