导出GCP数据存储区并导入到其他GCP项目 [英] Export GCP Datastore and import to a different GCP Project

查看:73
本文介绍了导出GCP数据存储区并导入到其他GCP项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将数据从一个GCP项目中的DataStore复制到另一个项目-该过程似乎没有出现任何错误,但是也没有填充我的目标数据存储.

I'm trying to copy data from DataStore in one GCP project to another - the process doesn't seem to give any errors, but also doesn't populate my target datastore.

在我的源项目中,我创建一个存储桶,并将我的数据存储区导出到其中,如下所示:

In my source project I create a bucket and export my datastore in to it as follows :

gcloud datastore export gs://ctb_datatransfer

然后我切换到目标项目并运行

I then switch to my destination project and run

gcloud datastore import gs://ctb_datatransfer/2020-03-01T18:41:37_32872/2020-03-01T18:41:37_32872.overall_export_metadata

这两个步骤似乎都未指示任何错误,但是导入完成后,我的目标数据存储仍然为空.

Neither of these steps seem to indicate any errors, but my destination datastore remains empty after the import has completed.

很高兴收到任何帮助,因为我对所发生的事情并不十分了解-我相信我已经授予了存储桶正确的权限(如果没有,我会看到某种权限失败的消息)我猜不是)

Any help is gratefully received as I don't really have much of a clue about what is happening - I believe that I have granted the correct permissions on the bucket ( and would expect to see some sort of permissions failure if I hadn't I guess )

导出步骤的输出如下所示:

The output from the export step looks like this

    done: true
metadata:
  "@type": type.googleapis.com/google.datastore.admin.v1.ExportEntitiesMetadata
  common:
    endTime: "2020-03-01T18:41:50.349159Z"
    operationType: EXPORT_ENTITIES
    startTime: "2020-03-01T18:41:37.188012Z"
    state: SUCCESSFUL
  entityFilter: {}
  outputUrlPrefix: gs://ctb_datatransfer/2020-03-01T18:41:37_32872
  progressBytes:
    workCompleted: "8848"
    workEstimated: "6480"
  progressEntities:
    workCompleted: "40"
    workEstimated: "40"
name: projects/chattyappsdata-staging/operations/ASAzMTEwMzAzMTMJGnRsdWFmZWQHEjJ3LXVlLXNib2otbmltZGEQCigS
response:
  "@type": type.googleapis.com/google.datastore.admin.v1.ExportEntitiesResponse

而导入步骤的输出如下所示

while the output from the import step looks like this

    done: true
metadata:
  "@type": type.googleapis.com/google.datastore.admin.v1.ImportEntitiesMetadata
  common:
    endTime: "2020-03-01T18:46:25.251008Z"
    operationType: IMPORT_ENTITIES
    startTime: "2020-03-01T18:45:44.029056Z"
    state: SUCCESSFUL
  entityFilter: {}
  inputUrl: gs://ctb_datatransfer/2020-03-01T18:41:37_32872/2020-03-01T18:41:37_32872.overall_export_metadata
  progressBytes:
    workCompleted: "8110"
    workEstimated: "8848"
  progressEntities:
    workCompleted: "40"
    workEstimated: "40"
name: projects/chattytoolbox/operations/AiAwNTEwNDAxMTMJGnRsdWFmZWQHEjJ3LXVlLXNib2otbmltZGEQCigS
response:
  "@type": type.googleapis.com/google.protobuf.Empty

推荐答案

如OP在评论中所述,整个过程最终都可以正常工作,只是几个小时后才完成.这是一个可能的解释:

As stated by OP in the comments, the whole process ended up working, it just did it hours later. This is a possible explanation:

在查看有关导入实体的文档时,我发现导入是已完成,但我认为它缺少一些传播,但随着时间的流逝而固定.

Looking at the documentation about importing entities, I've found that the import is a long running operation (LRO) and thus it may take a substantial amount of time to complete. From the import output you shared, we can see that the operation did finish, but I believe it was missing some propagation, which got fixed by time.

此外,导入命令( gcloud datastore import )仅会启动LRO.如果您指定参数 -async 该命令将立即返回,但如果没有返回,它将等待响应.在gcloud标签上的本节上,该标签指出即使取消导入命令,操作也将继续,从而加强了关于命令,导入和传播的独立性的理论.

Also, the import command (gcloud datastore import) it just starts the LRO. If you specify the argument --async the command will return immediately but if you don't, it will wait for a response. On this section, on the gcloud tab, it's stated that even if the import command gets cancelled the operation will continue, thus reinforcing the theory about the independence of the command, the import and the propagation.

这篇关于导出GCP数据存储区并导入到其他GCP项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆