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
你这样做:
为您的项目创建 Cloud Storage 存储分区 - 确保它是 us-central1 或 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/导出导入
这篇关于Firestore 新数据库 - 如何备份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!