Spark 结构化流 qubole Kinesis 连接器错误并显示“获取凭据时出现异常”

发布于 2025-01-14 15:33:26 字数 1057 浏览 5 评论 0原文

我使用以下代码从 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

如梦 2025-01-21 15:33:26

我也遇到了这个问题 - 添加 .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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文