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
相关推荐
lizhihai_994 小时前
股市学习心得—半导体12种核心材料
大数据·人工智能·学习
ZGi.ai4 小时前
智能客服系统设计:从工单分类到自动派单的工程实现
大数据·人工智能·分类
PaperData4 小时前
2000-2023年地级市数字基础设施评价指标体系
大数据·网络·数据库·人工智能·数据分析·经管
Blockchain Learning4 小时前
去中心化身份(DID)模型解析:区块链如何重塑身份管理?
大数据·去中心化·区块链
xcbrand5 小时前
政府事业机构品牌策划公司哪家可靠
大数据·人工智能·python
程序鉴定师5 小时前
如何选择合适的深圳小程序开发公司?
大数据·小程序
晨启AI6 小时前
GPT-5.5 来了!OpenAI 最新提示词指南深度解读
大数据·人工智能·ai·提示词
地球资源数据云6 小时前
中国陆地生态系统主要植物功能特征空间分布数据
大数据·数据库·人工智能·机器学习
金智维科技官方6 小时前
AI智能体在7×24客服场景中的真实表现评估
大数据·人工智能·ai·rpa·智能体
WL_Aurora7 小时前
MapReduce经典例题【第二期】
大数据·mapreduce