1,从spark的example中找到KafkaWordCount.scala文件复制到idea编辑器中,引入包:
IDEA中运行KafkaWordCount程序
2,编辑configuration,
    (1)KafkaWordCountProducer
    选择KafkaWordCount.scala中的KafkaWordCountProducer方法
    VM options 设置为:-Dspark.master=local
    设置程序输入参数,Program arguments: localhost:9092 test 3 5
具体信息如下
IDEA中运行KafkaWordCount程序
    (2)KafkaWordCount
    配置如下:
    IDEA中运行KafkaWordCount程序
3,先运行KafkaWordCountProducer,再运行KafkaWordCount,在KafkaWordCount的输出窗口中可以看到如下两个情况:
IDEA中运行KafkaWordCount程序
IDEA中运行KafkaWordCount程序

相关文章:

  • 2021-06-21
  • 2021-08-27
  • 2022-12-23
  • 2021-11-18
  • 2022-12-23
  • 2021-07-08
猜你喜欢
  • 2022-12-23
  • 2021-09-22
  • 2021-10-17
  • 2021-11-02
  • 2021-12-14
  • 2022-02-07
  • 2022-12-23
相关资源
相似解决方案