一准备数据
在/opt下创建datas文件夹, /opt/datas是自定义指定的监听目录,启动flume之前是空文件夹。
启动成功后把之前准备好的两个测试文件复制到监听目录下。
[root@master tmp]# cp a1test /opt/datas
[root@master tmp]# cp tmp.txt /opt/datas
[root@master tmp]# cat a1test
慈母手中线,游子身上衣。
临行密密缝,意恐迟迟归。
谁言寸草心,报得三春晖。
[root@master tmp]# cat tmp.txt
我想吃饭
我想吃饭
[root@master tmp]#
二启动Hadoop集群
进入/root/bigdata/hadoop2.7.3/sbin目录下
启动命令:start-all.sh
三设置flume配置文件
进入flume的conf文件下创建agent01.conf文件 并进行编辑
# 配置拦截器
定义三大组件的名称
agent1.sources = source1
agent1.sinks = sink1
agent1.channels = channel1
# 配置source组件
agent1.sources.source1.type = spooldir
agent1.sources.source1.spoolDir = /opt/datas
agent1.sources.source1.fileHeader = false
# 配置拦截器
agent1.s