Spark Streaming实时流处理笔记(6)—— Kafka 和 Flume的整合

1 整体架构

在这里插入图片描述

2 Flume 配置

https://flume.apache.org/releases/content/1.6.0/FlumeUserGuide.html
启动kafka kafka-server-start.sh $KAFKA_HOME/config/server.properties
在这里插入图片描述

avro-memory-kafka.conf

# Name the components on this agent                        
avro-memory-kafka.sources = avro-source                    
avro-memory-kafka.sinks = kafka-sink                       
avro-memory-kafka.channels = memory-channel                
                                                           
# Describe/configure the source                            
avro-memory-kafka.sources.avro-source.type = avro          
avro-memory-kafka.sources.avro-source.bind = node1         
avro-memory-kafka.sources.avro-source.port = 44444         
                                                           
# Describe the sink                                        
avro-memory-kafka.sinks.kafka-sink.type = org.apache.flume.sink.kafka.KafkaSink
avro-memory-kafka.sinks.kafka-sink.brokerList = node1:9092 
avro-memory-kafka.sinks.kafka-sink.topic = hello_topic     
avro-memory-kafka.sinks.kafka-sink.batchSize = 5           
avro-memory-kafka.sinks.kafka-sink.requiredAcks = 1        
                                                           
# Use a channel which buffers events in memory             
avro-memory-kafka.channels.memory-channel.type = memory    
                                                           
                                                           
# Bind the source and sink to the channel                  
avro-memory-kafka.sources.avro-source.channels = memory-channel
avro-memory-kafka.sinks.kafka-sink.channel = memory-channel

2.1 启动 Flume

flume-ng agent --name avro-memory-kafka --conf $FLUME_HOME/conf --conf-file $FLUME_HOME/conf/myconf/avro-memory-kafka.conf -Dflume.root.logger=INFO,console

在这里插入图片描述

flume-ng agent --name exec-memory-avro --conf $FLUME_HOME/conf --conf-file $FLUME_HOME/conf/myconf/exec-memory-avro.conf -Dflume.root.logger=INFO,console

在这里插入图片描述

在这里插入图片描述

2.2 启动 Kafka

启动消费者

kafka-console-consumer.sh --zookeeper node1:2181 --topic hello_topic

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值