flume实战

时间:2019-09-28
本文章向大家介绍flume实战,主要包括flume实战使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

flume 三大组件

source 收集

channel 聚集

sink 输出

使用Flume关键就是写配置文件

A 配置source

B 配置channel

C 配置sink

D 把以上3个组件串起来

1.通过IP端口 接收数据

a1 agent名称
r1 数据源名称
k1 sinks名称
c1 channel名称
 
# example.conf: A single-node Flume configuration

# Name the components on this agent
a1.sources = r1
a1.sinks = k1
a1.channels = c1

# Describe/configure the source
a1.sources.r1.type = netcat
a1.sources.r1.bind =hadoop000
a1.sources.r1.port = 44444 # Describe the sink a1.sinks.k1.type = logger # Use a channel which buffers events in memory a1.channels.c1.type = memory # Bind the source and sink to the channel a1.sources.r1.channels = c1 a1.sinks.k1.channel = c1

启动agent

flume-ng agent  \

--name a1 \

--conf  $FLUME_HOME/conf \

--conf-file  $FLUME_HOME/conf/example.conf \

-Dflume.roog.logger=INFO,console

agent选型 : exec source+ memory channel + logger skin

# Name the components on this agent

a1.sources = r1
a1.sinks = k1
a1.channels = c1

# Describe/configure the source
a1.sources.r1.type = exec
a1.sources.r1.command=tail -f /home/hadoop/data/data.log
a1.sources.r1.shell=/bin/sh -c

# Describe the sink
a1.sinks.k1.type = logger

# Use a channel which buffers events in memory
a1.channels.c1.type = memory
# Bind the source and sink to the channel
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1

原文地址:https://www.cnblogs.com/yeqian100/p/11605235.html