Flink 与 Kafka Consumer 不起作用 [英] Flink with Kafka Consumer doesn't work

查看:31
本文介绍了Flink 与 Kafka Consumer 不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想对 Spark 与 Flink 进行基准测试,为此我做了几个测试.但是 Flink 不适用于 Kafka,同时使用 Spark 工作完美.

I want to benchmark Spark vs Flink, for this purpose I am making several tests. However Flink doesn't work with Kafka, meanwhile with Spark works perfect.

代码很简单:

val env: StreamExecutionEnvironment = StreamExecutionEnvironment.getExecutionEnvironment

val properties = new Properties()
properties.setProperty("bootstrap.servers", "localhost:9092")
properties.setProperty("group.id", "myGroup")
println("topic: "+args(0))
val stream = env.addSource(new FlinkKafkaConsumer09[String](args(0), new SimpleStringSchema(), properties))
stream.print

env.execute()

我使用具有相同主题的 kafka 0.9.0.0(在消费者 [Flink] 和生产者 [Kafka 控制台] 中),但是当我将 jar 发送到集群时,没有任何反应:

I use kafka 0.9.0.0 with the same topics (in consumer[Flink] and producer[Kafka console]), but when I send my jar to the cluster, nothing happens:

集群 Flink

会发生什么?

推荐答案

您的 stream.print 不会在 flink 上的控制台中打印.它会写入 flink0.9/logs/recentlog.否则,您可以添加自己的记录器来确认输出.

Your stream.print will not print in console on flink .It will write to flink0.9/logs/recentlog. Other-wise you can add your own logger for confirming output.

这篇关于Flink 与 Kafka Consumer 不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆