Я пытаюсь прочитать тему Kafka из кластера Spark с использованием API-интерфейса структурированной потоковой передачи с интеграцией Kafka в Spark
val sparkSession = SparkSession.builder()
.master("local[*]")
.appName("some-app")
.getOrCreate()
Создание потока Kafka
import sparkSession.implicits._
val dataFrame = sparkSession
.readStream
.format("kafka")
.option("subscribepattern", "preprod-*")
.option("kafka.bootstrap.servers", "<brokerUrl>:9094")
.option("kafka.ssl.protocol", "TLS")
.option("kafka.security.protocol", "SSL")
.option("kafka.ssl.key.password", secretPassword)
.option("kafka.ssl.keystore.location", "/tmp/xyz.jks")
.option("kafka.ssl.keystore.password", secretPassword)
.option("kafka.ssl.truststore.location", "/abc.jks")
.option("kafka.ssl.truststore.password", secretPassword)
.load()
.selectExpr("CAST(key AS STRING)", "CAST(value AS STRING)")
.as[(String, String)]
.writeStream
.format("console")
.start()
.awaitTermination()
с использованием командыкоманда
/usr/local/spark/bin/spark-submit
--packages "org.apache.spark:spark-streaming-kafka-0-10_2.11:2.3.1,org.apache.spark:spark-sql-kafka-0-10_2.11:2.3.1"
myjar.jar
Получение приведенной ниже ошибки
2018-09-28 07:29:23 INFO AbstractCoordinator:505 - Discovered coordinator brokerUrl.com:32400 (id: 2147483647 rack: null) for group spark-kafka-source-c72dcb79-f3bc-4dfd-86a5-9d14be48fa04-1188588017-executor.
2018-09-28 07:29:23 INFO AbstractCoordinator:505 - Discovered coordinator brokerUrl.com:32400 (id: 2147483647 rack: null) for group spark-kafka-source-c72dcb79-f3bc-4dfd-86a5-9d14be48fa04-1188588017-executor.
2018-09-28 07:29:23 INFO AbstractCoordinator:505 - Discovered coordinator brokerUrl.com:32400 (id: 2147483647 rack: null) for group spark-kafka-source-c72dcb79-f3bc-4dfd-86a5-9d14be48fa04-1188588017-executor.
2018-09-28 07:29:23 INFO AbstractCoordinator:505 - Discovered coordinator brokerUrl.com:32400 (id: 2147483647 rack: null) for group spark-kafka-source-c72dcb79-f3bc-4dfd-86a5-9d14be48fa04-1188588017-executor.
2018-09-28 07:29:47 WARN Fetcher:594 - Unknown error fetching data for topic-partition preprod-sanity-test-5
2018-09-28 07:30:25 WARN Fetcher:594 - Unknown error fetching data for topic-partition preprod-sanity-test-7
2018-09-28 07:30:27 WARN Fetcher:594 - Unknown error fetching data for topic-partition preprod-sanity-test-7
2018-09-28 07:30:27 WARN Fetcher:594 - Unknown error fetching data for topic-partition preprod-sanity-test-5
2018-09-28 07:30:50 WARN Fetcher:594 - Unknown error fetching data for topic-partition preprod-sanity-test-8
2018-09-28 07:30:50 WARN Fetcher:594 - Unknown error fetching data for topic-partition preprod-sanity-test-4
2018-09-28 07:30:50 WARN Fetcher:594 - Unknown error fetching data for topic-partition preprod-sanity-test-7
2018-09-28 07:30:50 WARN Fetcher:594 - Unknown error fetching data for topic-partition preprod-sanity-test-8
2018-09-28 07:30:50 WARN Fetcher:594 - Unknown error fetching data for topic-partition preprod-sanity-test-4
2018-09-28 07:30:50 WARN Fetcher:594 - Unknown error fetching data for topic-partition preprod-sanity-test-5
.....
....
so on