1、安装Flume:解压flume安装包,配置环境变量,删除(重命名)jar包
2、flume配置文件,新建文件如下
#声明变量
at2.sources =st2
at2.channels = ct2
at2.sinks = kt2
# For each one of the sources, the type is defined
#定义数据来源
at2.sources.st2.type = org.apache.flume.source.kafka.KafkaSource
at2.sources.st2.kafka.bootstrap.servers = node0.***:9200,node1.***:9200,node2.***:9200
#kafka主题
at2.sources.st2.kafka.topics = flume-test
#kafka的groupid
at2.sources.st2.kafka.consumer.group.id = flume-to-file-test-group-id
#设置从头开始读取kafka
at2.sources.st2.kafka.consumer.auto.offset.reset=earliest
# The channel can be defined as follows.
at2.sources.st2.channels = ct2
at2.sources.st2.kafka.batchSize = 100
# Each sink's type must be defined
#设置数据去向(写入到文件夹)
at2.sinks.kt2