Druid 不能 see/read GOOGLE_APPLICATION_CREDENTIALS 在 env 路径上定义

Druid can not see/read GOOGLE_APPLICATION_CREDENTIALS defined on env path

我将 apache-druid-0.22.1 安装为集群(主节点、数据节点和查询节点)并通过将其添加到数组 druid.extensions.loadList 中启用“druid-google-extensions” common.runtime.properties。 最后,我定义了 GOOGLE_APPLICATION_CREDENTIALS(它具有 https://cloud.google.com/docs/authentication/production 中定义的服务帐户 json 的值)作为 运行 德鲁伊服务的用户的环境变量。 但是,当我尝试从 GCR 存储桶中提取数据时出现以下错误:

Error: Cannot construct instance of org.apache.druid.data.input.google.GoogleCloudStorageInputSource, problem: Unable to provision, see the following errors: 1) Error in custom provider, java.io.IOException: The Application Default Credentials are not available. They are available if running on Google App Engine, Google Compute Engine, or Google Cloud Shell. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining the credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information. at org.apache.druid.common.gcp.GcpModule.getHttpRequestInitializer(GcpModule.java:60) (via modules: com.google.inject.util.Modules$OverrideModule -> org.apache.druid.common.gcp.GcpModule) at org.apache.druid.common.gcp.GcpModule.getHttpRequestInitializer(GcpModule.java:60) (via modules: com.google.inject.util.Modules$OverrideModule -> org.apache.druid.common.gcp.GcpModule) while locating com.google.api.client.http.HttpRequestInitializer for the 3rd parameter of org.apache.druid.storage.google.GoogleStorageDruidModule.getGoogleStorage(GoogleStorageDruidModule.java:114) at org.apache.druid.storage.google.GoogleStorageDruidModule.getGoogleStorage(GoogleStorageDruidModule.java:114) (via modules: com.google.inject.util.Modules$OverrideModule -> org.apache.druid.storage.google.GoogleStorageDruidModule) while locating org.apache.druid.storage.google.GoogleStorage 1 error at [Source: (org.eclipse.jetty.server.HttpInputOverHTTP); line: 1, column: 180] (through reference chain: org.apache.druid.indexing.overlord.sampler.IndexTaskSamplerSpec["spec"]->org.apache.druid.indexing.common.task.IndexTask$IndexIngestionSpec["ioConfig"]->org.apache.druid.indexing.common.task.IndexTask$IndexIOConfig["inputSource"]) A case reported on this matter caught my attention. But I can not see any verified solution to that case. Please help me.

我们想将数据从 GCP 传输到本地 Druid。我们不想在 GCP 中使用集群。所以我们要解决这个问题。

您必须定义指向文件路径且不包含文件内容的 GOOGLE_APPLICATION_CREDENTIALS

在集群(如 Kubernetes)中,通常会挂载一个包含文件的卷,并将 env var 设置为指向该卷。

对于未来的访问者:

如果你 运行 Druid by systemctl 那么你需要在 systemctl 的服务文件中添加所需的环境,以确保无论用户或环境发生变化,它总是交付给 druid。