[英]Migrating from Google Datatore To Firestore in Datastore mode
I was trying to find a step by step guide to migrate an existing project working with Datastore to the new Firebase in Datastore mode. 我试图找到逐步指南,以将使用数据存储的现有项目迁移到数据存储模式下的新Firebase。 If you do not want to wait for the Automatic migration to Firestore here is my experience with the migration. 如果您不想等待自动迁移到Firestore,这是我的迁移经验。
Documentation page "Exporting and Importing Entities" has the steps, but I struggled a bit figuring things out. 文档页面“导出和导入实体”中包含步骤,但是我很难弄清楚。 So I thought I'd share my experience. 所以我想我会分享我的经验。
Some notes to consider: 一些注意事项:
gcloud config set project <your-old-project-id>
Export your database to the newly created bucket gcloud datastore export gs://<your-new-bucket-name>
(on your old project) 将数据库导出到新创建的存储桶gcloud datastore export gs://<your-new-bucket-name>
(在您的旧项目上)
Waiting for [projects/[your-old-project-id]/operations/AvcsdafSDFasdfI3MDQJGnRsdWFmZWQHEmVwb3J1Z S1zYm9qLW5asdfcsopEg] to finish...done. 等待[projects / [your-old-project-id] / operations / AvcsdafSDFasdfI3MDQJGnRsdWFmZWQHEmVwb3J1Z S1zYm9qLW5asdfcsopEg]完成...完成。
From Google Console go to IAM page (still on your old project) 从Google控制台转到IAM页面 (仍在您的旧项目中)
Add the new project service account account and grant " Cloud Datastore Import Export Admin " & " Storage Admin " permissions ( NOTE: for some reason when adding the " Storage viewer " only permission I got the below error, so I used the " Storage Admin " instead!) 添加新的项目服务帐户帐户并授予“ Cloud Datastore Import Export Admin ”和“ Storage Admin ”权限( 注意:由于某些原因,当添加“ Storage Viewer ”唯一权限时,出现以下错误,因此我使用了“ Storage Admin “代替!)
"details: [new-project-service-account] @appspot.gserviceaccount.com does not have storage.buckets.get access to [new-project-id] .appspot.com." “详细信息: [new-project-service-account] @ appspot.gserviceaccount.com没有storage.buckets.get访问[new-project-id] .appspot.com。”
Move to your new project gcloud config set project <your-NEW-project-id>
移至新项目gcloud config set project <your-NEW-project-id>
Import the data from your storage bucket gcloud datastore import gs://<your-bucket-path>/[FILENAME].overall_export_metadata
, when done you should see a message similar to export 从存储桶中导入数据gcloud datastore import gs://<your-bucket-path>/[FILENAME].overall_export_metadata
,完成后,您应该会看到类似于export的消息
Waiting for [projects/[your-old-project-id]/operations/AaredafSDFa2otbmltZGEQCigSFmZWQHEmVwb3J1Z S1z2otbmltZGEQCigS] to finish...done. 等待[项目/ [您的旧项目ID] /操作/ AaredafSDFa2otbmltZGEQCigSFmZWQHEmVwb3J1Z S1z2otbmltZGEQCigS]完成...完成。
Optional : feel free to remove the new project service account permission from the old project IAM page 可选 :随时从旧项目IAM页面中删除新的项目服务帐户权限
If you browser to your new project Datastore page, you should see your migrated Entities 如果浏览到新项目的“数据存储”页面,则应看到已迁移的实体
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.