flume入门配置+简单实例(一)

xiaoxiao2021-02-28  22

一、基本概念 

1.source

2.channel

3.sink

二、配置文件

通常写在/conf下。

举个例子:

在flume目录下:

vi ./conf/flume-conf.properties

1.写source、channel、sink名字

2.确定哪个source连接哪个channel、哪个channel连接sink 

3.sinks.type、channels.type、sources.type

三、简单实例

使用spooling directory source 和logger link的flume配置

#conf source、sink、channel name agent1.sources = source1 agent1.sinks = sink1 agent1.channels = channel1 #set channels for sources and sinks agent1.sources.source1.channels = channel1 agent.sinks.sink1.channel = channel1 #set sources agent1.sources.source1.type = spooldir agent1.sources.source1.spoolDir = 需要监控的路径 #set sinks agent1.sinks.sink1.type = logger #set channels agent1.channels.channel1.type =file

    在本例中,flume代理仅运行了一个source-channel-sink组合。sink是一个logger sink,用于将事件记录控制台。此处的channel类型是file channel,所以channel中的事件可以持久存储到磁盘上。

    配置文件写好之后,使用flume-ng命令启动flume代理:

    flume-ng agent --conf $FLUME_HOME/conf --conf-file 配置文件名 --name agent1(代理名称) --Dflume.root.logger=INFO,console

转载请注明原文地址: https://www.6miu.com/read-2630120.html

最新回复(0)