linux快速安装flume并测试

flume1.6.0安装包获取:
链接:https://pan.baidu.com/s/1o_lrL1rTH1wSK8UkY76V-w
提取码:dbin

flume 安装

1…安装包导入linux,解压并重命名文件夹flume160

tar -zxf flume-ng-1.6.0-cdh5.14.2.tar.gz 
mv apache-flume-1.6.0-cdh5.14.2-bin soft/flume160

2.复制flume160/conf中的flume-env.sh.template为flume-env.sh,并修改其内容:

cp flume-env.sh.template flume-env.sh
vi flume-env.sh
--------------------------------------------
export JAVA_HOME=/opt/soft/jdk180

3.系统环境配置

vi /etc/profile
---------------------------------------
export FLUME_HOME=/opt/soft/flume160
export PATH=$PATH:$FLUME_HOME/bin

4.激活配置文件

source /etc/profile

5.检查版本,是否安装成功

flume-ng version
-----------------------------------------------------------------------
Flume 1.6.0-cdh5.14.2
Source code repository: https://git-wip-us.apache.org/repos/asf/flume.git
Revision: 50436774fa1c7eaf0bd9c89ac6ee845695fbb687
Compiled by jenkins on Tue Mar 27 13:55:10 PDT 2018
From source with checksum 30217fe2b34097676ff5eabb51f4a11d

6.flume配置文件
配置文件可以是 *.conf或者 *.properties文件,存放在指定文件夹中,我这里存放在/opt/flumeconf文件夹下
配置项 agent,根据要求设定source、channel、sink的可选项值。conf_text.properties内容:

# example.conf: A single-node Flume configuration-
# Name the components on this agent
#Agent 名称定为a1
#Source:可以理解为输入端,定义名称为 s1 
#channel:传输频道,定义为 c1,设置为内存模式 
#sinks:可以理解为输出端,定义为 sk1
a1.sources = r1
a1.sinks = k1
a1.channels = c1

# Describe/configure the source
#设置 Source 的类型为 netcat 端口为 44444
a1.sources.r1.type = netcat
a1.sources.r1.bind = 192.168.197.106
a1.sources.r1.port = 44444

# Describe the sink
# 设置sink为logger模式
a1.sinks.k1.type = logger

# Use a channel which buffers events in memory
#设置 channel 信息,内存模式 	传输参数设置	
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 1000

# Bind the source and sink to the channel
# 指定输入输出源通道c1
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1

7.下载netcat,netcat进行端口会话
yum install nmap-ncat.x86_64 -y

8.指定配置文件启动flume
a.指定配置文件路径,指定输出文件形式logger及信息类型INFO和输出位置console 。
flume-ng agent -n agent_name -c conf -f flume配置文件路径 [-Dflume.root.logger=INFO,console(控制台打印信息)]

flume-ng agent -n a1 -c conf -f /opt/flumeconf/conf_text.properties  -Dflume.root.logger=INFO,console

b.在新窗口启动netcat :nc ip 端口(44444)

[root@hadoop1 ~]# nc 192.168.197.106 44444
awdaw
OK

再看flume窗口,在控制台中可以接收到信息

20/08/18 09:53:27 INFO sink.LoggerSink: Event: { headers:{} body: 61 77 64 61 77                    awdaw }

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值