gaborgsomogyi commented on a change in pull request #25412:
[SPARK-28691][EXAMPLES] DirectKafkaWordCount support kafka with kerberos
URL: https://github.com/apache/spark/pull/25412#discussion_r312956496
##########
File path:
examples/src/main/scala/org/apache/spark/examples/streaming/DirectKafkaWordCount.scala
##########
@@ -44,26 +55,31 @@ object DirectKafkaWordCount {
| <brokers> is a list of one or more Kafka brokers
| <groupId> is a consumer group name to consume from topics
| <topics> is a list of one or more kafka topics to consume from
+ | <kerberosOn> is a boolean indicate if kafka using kerberos
authentication
|
""".stripMargin)
System.exit(1)
}
StreamingExamples.setStreamingLogLevels()
- val Array(brokers, groupId, topics) = args
+ val Array(brokers, groupId, topics) = args.take(3)
+ val kerberosOn = if (args.length > 3)
Try(args(3).toBoolean).getOrElse(false) else false
// Create context with 2 second batch interval
val sparkConf = new SparkConf().setAppName("DirectKafkaWordCount")
val ssc = new StreamingContext(sparkConf, Seconds(2))
// Create direct kafka stream with brokers and topics
val topicsSet = topics.split(",").toSet
- val kafkaParams = Map[String, Object](
+ var kafkaParams = Map[String, Object](
ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG -> brokers,
ConsumerConfig.GROUP_ID_CONFIG -> groupId,
ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG ->
classOf[StringDeserializer],
ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG ->
classOf[StringDeserializer])
+ if (kerberosOn) {
+ kafkaParams += (CommonClientConfigs.SECURITY_PROTOCOL_CONFIG ->
"SASL_PLAINTEXT")
Review comment:
Same here.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]