Flume和kafka的整合:使用Flume将日志数据抽取到Kafka中

文章目录


1、Kafka作为Source【数据进入到kafka中,抽取出来】

kafka源 --> memory --> 控制台:

bash 复制代码
a1.sources = r1
a1.sinks = k1
a1.channels = c1

# Bind the source and sink to the channel
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1

a1.sources.r1.type = org.apache.flume.source.kafka.KafkaSource
a1.sources.r1.batchSize = 100
a1.sources.r1.batchDurationMillis = 2000
a1.sources.r1.kafka.bootstrap.servers = node01:9092,node02:9092,node03:9092
a1.sources.r1.kafka.topics = five
a1.sources.r1.kafka.consumer.group.id = donghu

# Use a channel which buffers events in memory
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 100

a1.sinks.k1.type = logger
a1.sinks.k1.maxBytesToLog = 128

2、kafka作为Sink 【数据从别的地方抽取到kafka里面】

netcat --> memory -->kafka:

bash 复制代码
##a1就是flume agent的名称
## source r1
## channel c1
## sink k1
a1.sources = r1
a1.sinks = k1
a1.channels = c1

# Describe/configure the source
a1.sources.r1.type = netcat
a1.sources.r1.bind = bigdata01
a1.sources.r1.port = 44444

# 修改sink为kafka
a1.sinks.k1.type = org.apache.flume.sink.kafka.KafkaSink
a1.sinks.k1.kafka.bootstrap.servers = node01:9092
a1.sinks.k1.kafka.topic = five
a1.sinks.k1.kafka.producer.acks = 1
a1.sinks.k1.kafka.producer.linger.ms = 1

# Use a channel which buffers events in memory
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 100

# Bind the source and sink to the channel
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1
相关推荐
remCoding1 小时前
Java全栈面试实录:从电商场景到AIGC的深度技术考察
spring boot·redis·spring cloud·ai·kafka·aigc·java面试
倔强的石头1061 小时前
大数据时代下的时序数据库选型指南:基于工业场景的IoTDB技术优势与适用性研究
大数据·时序数据库·iotdb
火火PM打怪中4 小时前
产品经理如何绘制服务蓝图(Service Blueprint)
大数据·产品经理
cui_win12 小时前
Kafka 配置参数详解:ZooKeeper 模式与 KRaft 模式对比
分布式·zookeeper·kafka
Elastic 中国社区官方博客12 小时前
在 Windows 上使用 Docker 运行 Elastic Open Crawler
大数据·windows·爬虫·elasticsearch·搜索引擎·docker·容器
一切顺势而行14 小时前
Flink cdc 使用总结
大数据·flink
cui_win16 小时前
深入理解 Kafka 核心:主题、分区与副本的协同机制
网络·分布式·kafka
淦暴尼16 小时前
基于spark的二手房数据分析可视化系统
大数据·分布式·数据分析·spark
Ashlee_code17 小时前
裂变时刻:全球关税重构下的券商交易系统跃迁路线图(2025-2027)
java·大数据·数据结构·python·云原生·区块链·perl
Flink_China17 小时前
淘天AB实验分析平台Fluss落地实践:更适合实时OLAP的消息队列
大数据·flink