简体   繁体   English

无法将公有云 PostgreSQL 实例连接到公有云数据融合实例

[英]Cannot connect Public Cloud PostgreSQL instance to Public Cloud Data Fusion Instance

I am trying to Connect Both Public Cloud SQL and Data Fusion instances but ended up receiving the 403 error.我正在尝试连接 Public Cloud SQL 和 Data Fusion 实例,但最终收到 403 错误。

Failed to create connection to database via connection string: jdbc:postgresql:///analytics?cloudSqlInstance=chatbot-dev-356403:europe-central2:chatbot&socketFactory=com.google.cloud.sql.postgres.SocketFactory and arguments: {user=chatbot-dev}. Error: GoogleJsonResponseException: 403 Forbidden { "code" : 403, "errors" : [ { "domain" : "global", "message" : "The client is not authorized to make this request.", "reason" : "notAuthorized" } ], "message" : "The client is not authorized to make this request." }. Make sure you specify the correct connection properties.

I am not sure if it's a permission issue.我不确定这是否是权限问题。 I have the following permissions in my service account added during Data fusion instance creation:在数据融合实例创建期间,我在我的服务帐户中添加了以下权限:

roles/storage.admin
roles/datafusion.admin
roles/datafusion.runner
roles/datafusion.serviceAgent
roles/dataproc.worker
roles/cloudsql.admin
roles/cloudsql.client

Also I can see another service account in the instance but Not sure if I have to add permissions to this account too?我还可以在实例中看到另一个服务帐户,但不确定是否也必须向该帐户添加权限?

Have you followed the instructions here: https://cloud.google.com/data-fusion/docs/how-to/reading-from-postgresql ?您是否按照此处的说明进行操作: https ://cloud.google.com/data-fusion/docs/how-to/reading-from-postgresql?

I had the same problem because I was looking to the Service Account and Dataproc service account defined in the Data Fusion instance, but those are not the service accounts requiring permissions.我遇到了同样的问题,因为我正在查看 Data Fusion 实例中定义的服务帐户和 Dataproc 服务帐户,但这些不是需要权限的服务帐户。

I had to:我不得不:

  1. Go into the IAM进入 IAM
  2. Select the Grant Access action.选择授予访问权限操作。
  3. Find the service-PROJECT_NUMBER@gcp-sa-datafusion.iam.gserviceaccount.com service account and grant the roles at step #13 in the link I sent.找到 service-PROJECT_NUMBER@gcp-sa-datafusion.iam.gserviceaccount.com 服务帐户并在我发送的链接中的第 13 步授予角色。

After performing those actions everything worked fine.执行这些操作后,一切正常。

Please let us know if that works out for you.请让我们知道这是否适合您。

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

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