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
相关推荐
用户36105886261214 小时前
Kafka源码深度剖析:KafkaProducer最终如何处理响应
kafka
黑十14 小时前
FDE 怎么快速搭一个可演示页面?最小前端方案
java·大数据·前端·数据库·人工智能
Databend15 小时前
OpenRaft 自定义 Membership,按部署拓扑选择 Quorum
大数据·数据库·数据分析
Databend15 小时前
用 SQL 排查支付故障,OpenTelemetry 接入 Databend Cloud 实战
大数据·数据库·sql
上海潭龙东海科技有限公司16 小时前
智慧堆场动态模型三维实时孪生重构智能管控
大数据·网络·数据库·算法·重构
尹文祥17 小时前
Apache Doris 2.1.10:存储结构、索引与查询优化详解
大数据
isfox19 小时前
Hadoop 序列化:为什么不用 Java 自带 Serializable?
大数据
字节跳动数据平台21 小时前
火山引擎 VeKnow 落地指南(下):从知识编译到价值渗透
大数据
AI源码1 天前
基于Spark的期刊推荐系统的设计与实现
大数据·分布式·spark
玩美数据1 天前
海外市场数据分析驱动下的产业趋势演变与竞争格局深度解读
大数据·人工智能