如何使用flume从kafka获取数据

omqzjyyz  于 2021-06-04  发布在  Flume
关注(0)|答案(0)|浏览(204)

现在,我要用Flume从Kafka号上获取数据。我想实现的是每30分钟消耗一次Kafka的数据,并将数据写入文件中,我可以用它来进行在线学习。配置如下:


# Name the components on this agent

a1.sources = r1
a1.sinks = k1
a1.channels = c1

# Describe/configure the source

a1.sources.r1.type = org.apache.flume.source.kafka.KafkaSource
a1.sources.r1.batchSize = 5000
a1.sources.r1.batchDurationMillis = 2000
a1.sources.r1.kafka.zookeeperConnect = host
a1.sources.r1.kafka.topics = topic

# Use a channel which buffers events in memory

a1.channels.c1.type = file

# Bind the source and sink to the channel

a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1

a1.sinks.k1.type  = file_roll
a1.sinks.k1.sink.directory = /home/flume_log
a1.sinks.k1.sink.rollInterval=30
a1.sinks.k1.channel  =  c1

如果配置出错。当我运行test.conf时,虽然我已经生成了一些数据,但是我无法在文件中获得它。所有文件都是空的

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题