简体   繁体   English

如何在 Eclipse 中设置 GCP 凭据以运行 Dataflow 管道

[英]How to set GCP credential in Eclipse to run Dataflow pipeline

I have a pipeline which have been developed using Java in Eclipse.我有一个在 Eclipse 中使用 Java 开发的管道。

After install the Cloud SDK for Eclipse I can run the pipeline locally (direct runner) with the Dataflow configuration:为 Eclipse 安装 Cloud SDK 后,我可以使用 Dataflow 配置在本地(直接运行器)运行管道:

数据流

I would also like to run it locally using maven configuration.我还想使用 maven 配置在本地运行它。

The problem I have if I try to execute it using maven is about credential when the pipeline try to create a pubsub subscription.如果我尝试使用 maven 执行它,我遇到的问题是管道尝试创建 pubsub 订阅时的凭据。

Exception: org.apache.beam.sdk.Pipeline$PipelineExecutionException: java.lang.RuntimeException: Failed to create subscription to topic projects/xxx/topics/test on project projects/xxx: 403 Forbidden

{
  "code" : 403,
  "errors" : [ {
    "domain" : "global",
    "message" : "The request is missing a valid API key.",
    "reason" : "forbidden"
  } ],
  "message" : "The request is missing a valid API key.",
  "status" : "PERMISSION_DENIED"
}
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  7.154 s
[INFO] Finished at: 2019-12-12T11:19:36+01:00
[INFO] ------------------------------------------------------------------------

I have the cloud shell installed and configured.我已经安装并配置了云外壳。 Also set the env variable GOOGLE_APPLICATION_CREDENTIALS还要设置环境变量 GOOGLE_APPLICATION_CREDENTIALS


I also have the same error if I execute the mvn command in my cmd (also gcp shell)如果我在我的 cmd(也是 gcp shell)中执行 mvn 命令,我也会有同样的错误

You can run the below command in a shell and then try to run the job您可以在 shell 中运行以下命令,然后尝试运行该作业

gcloud auth application-default login

Alternatively you can also see here on how to setup eclipse for GCP - https://cloud.google.com/dataflow/docs/quickstarts/quickstart-java-eclipse或者,您也可以在此处查看如何为 GCP 设置 eclipse - https://cloud.google.com/dataflow/docs/quickstarts/quickstart-java-eclipse

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM