IDEA中运行DirectKafkaWordCount程序

1,将SPARK_HOME中的DirectKafkaWordCount程序复制到idea中.
2,由于在KafkaWordCount中已引入相关jar包,此步可略过
3,配置configurations参数
 
关于program arguments参数,程序中定义如下:
/**
* Consumes messages from one or more topics in Kafka and does wordcount.
* Usage: DirectKafkaWordCount <brokers> <topics>
* <brokers> is a list of one or more Kafka brokers
* <topics> is a list of one or more kafka topics to consume from
*
* Example:
* $ bin/run-example streaming.DirectKafkaWordCount broker1-host:port,broker2-host:port \
* topic1,topic2
*/
第一个参数为一系列的brokers,可以设置多个;第二个参数为一系列topic,也可以设置为多个.
本次运行时只采用localhost:9092和test
4,将之前的KafkaWordCountProducer运行起来,运行DirectKafkaWordCount可以看到如下结果:

也可不运行KafkaWordCountProducer,而是另外起一个console服务,在窗口中运行kafka-console-producer.sh --broker-list localhost:9092 --sync --topic test

转载于:https://www.cnblogs.com/wuyida/p/6300254.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值