Github user SaintBacchus commented on the pull request:

    https://github.com/apache/spark/pull/7255#issuecomment-119175926
  
    @harishreedharan I  had tested it out, your batch did not apply my issue
    Use this command twice (both the principal is expired)
    ```
    bin/spark-submit --class xx.KafkaWordCount --master yarn-client --principal 
spark/[email protected]   --keytab spark.keytab
    ```
    The second time it will throw this exception:
    ```
     javax.security.sasl.SaslException: GSS initiate failed [Caused by 
GSSException: No valid credentials provided (Mechanism level: Failed to find 
any Kerberos tgt)]
    ```
    
    WordCount Code:
    ```scala
        val ssc = StreamingContext.getOrCreate("checkpoint", ()=> 
{wordCountFunction(args)})
        ssc.start()
        ssc.awaitTermination()
    
    
      def wordCountFunction(args: Array[String]) = {
        val Array(zkQuorum, group, topics, numThreads) = args
        val sparkConf = new SparkConf().setAppName("KafkaWordCount")
        val ssc =  new StreamingContext(sparkConf, Seconds(5))
        ssc.checkpoint("checkpoint")
    
        val topicMap = topics.split(",").map((_,numThreads.toInt)).toMap
        val lines = KafkaUtils.createStream(ssc, zkQuorum, group, 
topicMap).map(_._2)
        val words = lines.flatMap(_.split(" "))
        val wordCounts = words.map(x => (x, 
1L)).reduceByKey(_+_).transform(x=>x.sortByKey())
        wordCounts.print()
        ssc
      }
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to