簡體   English   中英

使用 Azure 數據塊配置 Confluent kafka 時遇到問題

[英]Facing issue while configuring Confluent kafka with Azure databricks

我是 Azure databrciks 和這個論壇的新手。 我實際上是在 Azure 數據塊上進行 Steaming Confluent Kafka 的練習。 我能夠 stream 火花上的內容。 但是,由於我在程序中公開了用戶名和密碼,因此存在一些小問題。 我寧願通過變量(或 Azure 密鑰庫)傳遞它。 我試過使用變量傳遞用戶名和密碼,但這種方法不起作用。 我收到錯誤提示“無法創建 Kafka 消費者”。 你能告訴我如何繼續嗎? 我為此使用 scala。

val streamingInputDF = spark
.readStream
.format("kafka")
.option("kafka.bootstrap.servers", host)
.option("kafka.security.protocol", "SASL_SSL")
.option("kafka.sasl.jaas.config", "kafkashaded.org.apache.kafka.common.security.plain.PlainLoginModule required username=\"AAAAAA\" password=\BBBBB\";")
.option("kafka.ssl.endpoint.identification.algorithm", "https")
.option("kafka.sasl.mechanism", "PLAIN")
.option("startingOffsets", "earliest")
.option("failOnDataLoss", "false")
.option("subscribe", "Test")
.load()

這就是我想通過但不工作的方式:-

val streamingInputDF = spark
.readStream
.format("kafka")
.option("kafka.bootstrap.servers", host)
.option("kafka.security.protocol", "SASL_SSL")
.option("kafka.sasl.jaas.config", f"kafkashaded.org.apache.kafka.common.security.plain.PlainLoginModule required username=$username password=$password";")
.option("kafka.ssl.endpoint.identification.algorithm", "https")
.option("kafka.sasl.mechanism", "PLAIN")
.option("startingOffsets", "earliest")
.option("failOnDataLoss", "false")
.option("subscribe", "streaming_test_6")
.load()

您需要檢查以下幾點:

  1. 確保您的 class 路徑中有 kafka-clients jar。

  2. 確保安裝了兼容版本的 kafka 和 spark

可以參考ANGELA CHU, GIANLUCA NATALI AND CAIO MORENO 的文章,里面有詳細的說明。

Scala 筆記本鏈接

感謝所有試圖提供建議的人。 我能夠解決問題。 下面是需要更改的行

.option("kafka.sasl.jaas.config",
   "kafkashaded.org.apache.kafka.common.security.plain.PlainLoginModule required username=\"" + confluentApiKey + "\"password=\"" + confluentSecret + "\";")

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM