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
相关推荐
赞奇科技Xsuperzone1 小时前
【首发】DGX Spark 三机互连跑 Qwen3-235B-A22B-FP8!
大数据·分布式·spark
poemyang2 小时前
从硬盘I/O到网络传输:Kafka与RocketMQ读写模型及零拷贝技术深度对比
kafka·零拷贝·消息中间件
leijiwen3 小时前
Bsin X BDCM:从流量驱动到价值激励驱动的智能增长引擎
大数据·人工智能·web3
fruge3 小时前
Git 进阶技巧:分支管理、冲突解决、提交规范实操
大数据·git·elasticsearch
1***y1784 小时前
区块链跨链桥、 跨链桥到底在解决什么问题?
大数据·人工智能·区块链
最笨的羊羊4 小时前
Flink CDC系列之:Kafka Debezium JSON 序列化器的实现DebeziumJsonSerializationSchema
kafka·debezium·schema·flink cdc系列·serialization·序列化器·debezium json
金融小师妹5 小时前
基于LSTM-GARCH混合模型:降息预期驱动金价攀升,白银刷新历史峰值的蒙特卡洛模拟验证
大数据·人工智能·深度学习·1024程序员节
有味道的男人5 小时前
速卖通商品详情接口(速卖通API系列)
java·大数据·数据库
天远云服6 小时前
Golang 硬核实战:手撸 AES-CBC 算法,对接天远风控决策接口
大数据·api