Spark 结构化流 qubole Kinesis 连接器错误并显示“获取凭据时出现异常”
我使用以下代码从 Spark 结构化流代码写入 Kinesis。它因以下错误而出错。 AWS 凭证具有管理员访问权限。我可以使用 aws 控制台。这里可能有什么问题?
22/03/16 13:46:34 错误 AWSInstanceProfileCredentialsProviderWithRetries:获取凭证 org.apache.spark.sql.kinesis.shaded.amazonaws.SdkClientException 时出现异常:无法从服务端点加载凭证
val finalDF = rawDF.select(expr("CAST(rand() AS STRING) as partitionKey"),
to_json(struct("*")).alias("data"))
finalDF.printSchema()
val query = finalDF.writeStream
.outputMode("update")
.format("kinesis")
.option("streamName", "sparkstream2")
.option("endpointUrl", "https://kinesis.us-east-1.amazonaws.com")
.option("region", "us-east-1")
.option("awsAccessKey", "") // Creds removed
.option("awsSecretKey", "") // Creds removed
.option("checkpointLocation", "chk-point-dir")
.start()
query.awaitTermination()
spark.stop()
Printschema 输出如下所示 根 |-- 分区键:字符串(可空 = false) |-- data: string (nullable = true)
我正在使用 qubole 的连接器 https://github.com/qubole/kinesis-sql
I am using the following code to write to Kinesis from a spark structured stream code. It errors out with following error. The AWS credentials have admin access. I am able to use aws console using that. What could be the issue here?
22/03/16 13:46:34 ERROR AWSInstanceProfileCredentialsProviderWithRetries: Got an exception while fetching credentials org.apache.spark.sql.kinesis.shaded.amazonaws.SdkClientException: Unable to load credentials from service endpoint
val finalDF = rawDF.select(expr("CAST(rand() AS STRING) as partitionKey"),
to_json(struct("*")).alias("data"))
finalDF.printSchema()
val query = finalDF.writeStream
.outputMode("update")
.format("kinesis")
.option("streamName", "sparkstream2")
.option("endpointUrl", "https://kinesis.us-east-1.amazonaws.com")
.option("region", "us-east-1")
.option("awsAccessKey", "") // Creds removed
.option("awsSecretKey", "") // Creds removed
.option("checkpointLocation", "chk-point-dir")
.start()
query.awaitTermination()
spark.stop()
Printschema output looks as follows
root
|-- partitionKey: string (nullable = false)
|-- data: string (nullable = true)
I am using the connector from qubole
https://github.com/qubole/kinesis-sql
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我也遇到了这个问题 - 添加
.option("awsUseInstanceProfile", "false")
。默认情况下,kinesis-sql 包并不像人们预期的那样处理 AWS 凭证。我在这里找到了这个 GitHub 问题作为线索。I had this issue too - add on
.option("awsUseInstanceProfile", "false")
. The kinesis-sql package doesn't handle AWS credentials by default as one would expect. I found this GitHub issue for a lead here.