Flume安装和简单测试

下载地址

http://archive.apache.org/dist/flume/1.6.0/

系统要求

Java运行时环境 - Java 1.8或更高版本

内存 - 源,通道或接收器使用的配置的足够内存

磁盘空间 - 通道或接收器使用的配置的足够磁盘空间

目录权限 - 代理使用的目录的读/写权限

=================================================================================

flume环境搭建

       上传flume二进制包到集群

       cp apache-flume-1.6.0-bin.tar.gz soft/

       解压:tar -zxvf /home/hyxy/soft/apache-flume-1.6.0-bin.tar.gz

       创建软连接:ln -s apache-flume-1.6.0-bin flume

       配置环境变量:vim ~/.bashrc

                加入

                export FLUME_HOME=/home/hyxy/soft/flume

                将flume加入到path里面

                 export PATH=$FLUME_HOME/bin:$SPARK_HOME/bin:.....

       验证成功:flume-ng version

打印以下信息

Flume 1.6.0

Source code repository: https://git-wip-us.apache.org/repos/asf/flume.git

Revision: 2561a23240a71ba20bf288c7c2cda88f443c2080

Compiled by hshreedharan on Mon May 11 11:15:44 PDT 2015

From source with checksum b29e416802ce9ece3269d34233baf43f

==========================================================================================

安装nc(netcat)

     sudo yum install -y nc

     测试nc

     开启一个服务:  nc -l 10000

     打开另一个终端:nc localhost 10000

                输入nihao

                服务端接受到 OK

============================================================================================

案例:接收nc发送的消息然后显示在控制台

配置配置文件(文件名随便)

cp flume-conf.properties.template example.conf

vim example.conf

 

# 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 = localhost

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

a1.channels.c1.capacity = 1000

a1.channels.c1.transactionCapacity = 100

# Bind the source and sink to the channel

a1.sources.r1.channels = c1

a1.sinks.k1.channel = c1

启动flume-ng(注意=左右没有空格)

格式:flume-ng agent --conf 【conf目录】 --conf-file 【要运行的conf文件】 --name agent -Dflume.root.logger=INFO,console

例:flume-ng agent --conf /home/hyxy/soft/flume/conf/ --conf-file example.conf --name agent -Dflume.root.logger=INFO,console

启动nc

nc localhost 44444

发送消息

随便

接受到消息(成功)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值