flume从kafka中读取数据

Posted wubinghuan

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了flume从kafka中读取数据相关的知识,希望对你有一定的参考价值。

a1.sources = r1
a1.sinks = k1
a1.channels = c1
 
#使用内置kafka source
a1.sources.r1.type = org.apache.flume.source.kafka.KafkaSource
#kafka连接的zookeeper
a1.sources.r1.zookeeperConnect = localhost:2181
a1.sources.r1.topic = kkt-test-topic
a1.sources.r1.batchSize = 100
a1.sources.r1.channels =c1
 
#这里写到hdfs中
a1.sinks.k1.channel = c1
a1.sinks.k1.type = hdfs
a1.sinks.k1.hdfs.path =hdfs://iz94rak63uyz/user/flume 
a1.sinks.k1.hdfs.writeFormat = Text
a1.sinks.k1.hdfs.fileType = DataStream
a1.sinks.k1.hdfs.rollInterval = 0
a1.sinks.k1.hdfs.rollSize = 1000000
a1.sinks.k1.hdfs.rollCount = 0
a1.sinks.k1.hdfs.batchSize = 1000
a1.sinks.k1.hdfs.txnEventMax = 1000
a1.sinks.k1.hdfs.callTimeout = 60000
a1.sinks.k1.hdfs.appendTimeout = 60000
 
 
# Use a channel which buffers events in memory
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 1000
 
# Bind the source and sink to the channel
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1

启动flume命令:

flume-ng agent --conf-file flume.conf --name a1 -Dflume.root.logger=INFO,console --conf = conf

  

以上是关于flume从kafka中读取数据的主要内容,如果未能解决你的问题,请参考以下文章

flume 读取kafka 数据

flume从kafka读取数据到hdfs中的配置

Flume 读取RabbitMq消息队列消息,并将消息写入kafka

004- Flume Source之Kafka

flume kafka spark读取日志延迟

数据采集flume kafka