PubSub Kafka Connect Google 从环境变量读取凭证文件的平台错误
PubSub Kafka Connect Google Platform error reading credential file from environment variable
所以,我正在尝试 运行 PubSub Kafka 连接器。我有一个本地 Kafka 服务器和本地 Zookeeper 运行ning。然后,我使用命令:
.\bin\windows\connect-standalone.bat .\etc\kafka\WorkerConfig.properties
.\etc\kafka\configSink.properties .\etc\kafka\configSource.properties
但我收到错误消息:
Error while starting connector CPSConnectorSource
org.apache.kafka.connect.errors.ConnectException: Error verifying the subscription TestSubscription for project kohls-sis-sandbox
at com.google.pubsub.kafka.source.CloudPubSubSourceConnector.verifySubscription(CloudPubSubSourceConnector.java:201)
at com.google.pubsub.kafka.source.CloudPubSubSourceConnector.start(CloudPubSubSourceConnector.java:116)
at org.apache.kafka.connect.runtime.WorkerConnector.doStart(WorkerConnector.java:100)
at org.apache.kafka.connect.runtime.WorkerConnector.start(WorkerConnector.java:125)
at org.apache.kafka.connect.runtime.WorkerConnector.transitionTo(WorkerConnector.java:182)
at org.apache.kafka.connect.runtime.Worker.startConnector(Worker.java:178)
at org.apache.kafka.connect.runtime.standalone.StandaloneHerder.startConnector(StandaloneHerder.java:250)
at org.apache.kafka.connect.runtime.standalone.StandaloneHerder.putConnectorConfig(StandaloneHerder.java:164)
at org.apache.kafka.connect.cli.ConnectStandalone.main(ConnectStandalone.java:94)
Caused by: java.io.IOException: Error reading credential file from environment variable GOOGLE_APPLICATION_CREDENTIALS, value 'C:\GooglePlatform\servicekey.json;': File does not exist.
at com.google.auth.oauth2.DefaultCredentialsProvider.getDefaultCredentialsUnsynchronized(DefaultCredentialsProvider.java:102)
at com.google.auth.oauth2.DefaultCredentialsProvider.getDefaultCredentials(DefaultCredentialsProvider.java:67)
at com.google.auth.oauth2.GoogleCredentials.getApplicationDefault(GoogleCredentials.java:54)
at com.google.auth.oauth2.GoogleCredentials.getApplicationDefault(GoogleCredentials.java:36)
at com.google.pubsub.kafka.common.ConnectorUtils.getChannel(ConnectorUtils.java:52)
at com.google.pubsub.kafka.source.CloudPubSubSourceConnector.verifySubscription(CloudPubSubSourceConnector.java:192)
... 8 more
Caused by: java.io.IOException: File does not exist.
at com.google.auth.oauth2.DefaultCredentialsProvider.getDefaultCredentialsUnsynchronized(DefaultCredentialsProvider.java:94)
... 13 more
我将环境变量 GOOGLE_APPLICATION_CREDENTIALS
设置为 C:\GooglePlatform\servicekey.json;
,文件位于指定位置。但是报错提示文件不存在,是不是环境变量设置错误?
所以,正如上面所说的“500 - 内部服务器错误”,我不得不删除系统变量GOOGLE_APPLICATION_CREDENTIALS中的分号。我也没有为我的服务帐户设置正确的角色。因此,请确保为您的服务帐户分配了 Pub/Sub 管理员角色。我还为我的服务帐户分配了 Pub/Sub 发布者角色,但只有 Pub/Sub 管理员角色可能有效。
我应该更仔细地阅读 运行 之前的步骤,here。
所以,我正在尝试 运行 PubSub Kafka 连接器。我有一个本地 Kafka 服务器和本地 Zookeeper 运行ning。然后,我使用命令:
.\bin\windows\connect-standalone.bat .\etc\kafka\WorkerConfig.properties
.\etc\kafka\configSink.properties .\etc\kafka\configSource.properties
但我收到错误消息:
Error while starting connector CPSConnectorSource
org.apache.kafka.connect.errors.ConnectException: Error verifying the subscription TestSubscription for project kohls-sis-sandbox
at com.google.pubsub.kafka.source.CloudPubSubSourceConnector.verifySubscription(CloudPubSubSourceConnector.java:201)
at com.google.pubsub.kafka.source.CloudPubSubSourceConnector.start(CloudPubSubSourceConnector.java:116)
at org.apache.kafka.connect.runtime.WorkerConnector.doStart(WorkerConnector.java:100)
at org.apache.kafka.connect.runtime.WorkerConnector.start(WorkerConnector.java:125)
at org.apache.kafka.connect.runtime.WorkerConnector.transitionTo(WorkerConnector.java:182)
at org.apache.kafka.connect.runtime.Worker.startConnector(Worker.java:178)
at org.apache.kafka.connect.runtime.standalone.StandaloneHerder.startConnector(StandaloneHerder.java:250)
at org.apache.kafka.connect.runtime.standalone.StandaloneHerder.putConnectorConfig(StandaloneHerder.java:164)
at org.apache.kafka.connect.cli.ConnectStandalone.main(ConnectStandalone.java:94)
Caused by: java.io.IOException: Error reading credential file from environment variable GOOGLE_APPLICATION_CREDENTIALS, value 'C:\GooglePlatform\servicekey.json;': File does not exist.
at com.google.auth.oauth2.DefaultCredentialsProvider.getDefaultCredentialsUnsynchronized(DefaultCredentialsProvider.java:102)
at com.google.auth.oauth2.DefaultCredentialsProvider.getDefaultCredentials(DefaultCredentialsProvider.java:67)
at com.google.auth.oauth2.GoogleCredentials.getApplicationDefault(GoogleCredentials.java:54)
at com.google.auth.oauth2.GoogleCredentials.getApplicationDefault(GoogleCredentials.java:36)
at com.google.pubsub.kafka.common.ConnectorUtils.getChannel(ConnectorUtils.java:52)
at com.google.pubsub.kafka.source.CloudPubSubSourceConnector.verifySubscription(CloudPubSubSourceConnector.java:192)
... 8 more
Caused by: java.io.IOException: File does not exist.
at com.google.auth.oauth2.DefaultCredentialsProvider.getDefaultCredentialsUnsynchronized(DefaultCredentialsProvider.java:94)
... 13 more
我将环境变量 GOOGLE_APPLICATION_CREDENTIALS
设置为 C:\GooglePlatform\servicekey.json;
,文件位于指定位置。但是报错提示文件不存在,是不是环境变量设置错误?
所以,正如上面所说的“500 - 内部服务器错误”,我不得不删除系统变量GOOGLE_APPLICATION_CREDENTIALS中的分号。我也没有为我的服务帐户设置正确的角色。因此,请确保为您的服务帐户分配了 Pub/Sub 管理员角色。我还为我的服务帐户分配了 Pub/Sub 发布者角色,但只有 Pub/Sub 管理员角色可能有效。
我应该更仔细地阅读 运行 之前的步骤,here。